FRemesher

[FRemesher](API\Plugins\DynamicMesh\FRemesher) implements edge flip/split/collapse/smooth Remeshing.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

DynamicMesh

Header

/Engine/Plugins/Experimental/GeometryProcessing/Source/DynamicMesh/Public/Remesher.h

Include

#include "Remesher.h"

Syntax

class FRemesher : public FMeshRefinerBase

Remarks

FRemesher implements edge flip/split/collapse/smooth Remeshing. The basic process is very similar to the one described in: A Remeshing Approach to Multiresolution Modeling. Botsch & Kobbelt, SGP 2004. https://graphics.uni-bielefeld.de/publications/sgp04.pdf

In the iterative usage, each call to BasicRemeshPass() makes a pass over the mesh and attempts to update the topology and shape to satisfy the target criteria. This function iterates over the mesh edges and calls ProcessEdge(), which tries to Collapse, then Split, then Flip the edge. After the topology pass, we optionally do a full-mesh Smoothing pass, and a full-mesh Reprojection pass, to project onto a target surface.

A highly flexible constraint system can be used to control what is allowed to happen to individual edges and vertices, as well as Project vertices onto arbitrary proejction targets. This is done via FMeshConstraints which is set in the MeshRefinerBase base class.

Many aspects of the algorithm can be controlled by the public variables in the block below. In addition many of the core internal functions can be overriden to customize behavior. Various callbacks functions are called when topology changes occur which allows you to for instance track changed regions of the mesh.

Variables

Name Description

Public variable

bool

 

bEnableCollapses

Controls whether edge collapses are allowed during remeshing pass

Public variable

bool

 

bEnableFlips

Configuration variables and flagsControls whether edge-flips are allowed during remeshing pass

Public variable

bool

 

bEnableParallelProjection

Enable parallel projection. Only applied in AfterRefinement mode

Public variable

bool

 

bEnableParallelSmooth

Enable parallel smoothing.

Public variable

bool

 

bEnableSmoothing

Controls whether vertex smoothing is applied during remeshing pass

Public variable

bool

 

bEnableSmoothInPlace

If smoothing is done in-place, we don't need an extra buffer, but also there will some randomness introduced in results.

Public variable

bool

 

bEnableSplits

Controls whether edge splits are allowed during remeshing pass

Protected variable

bool

 

bMeshIsClosed

We can avoid some checks/etc if we know that the mesh has no boundary edges.

Public variable

bool

 

bPreventNormalFlips

Controls whether we try to prevent normal flips inside operations and smoothing.

Protected variable

int

 

COUNT_COLLAPSES

Protected variable

int

 

COUNT_FLIPS

Protected variable

int

 

COUNT_SPLITS

Testing/debug/profiling stuff profiling functions, turn on ENABLE_PROFILING to see output in console

Public variable

TFunction< FVec...

 

CustomSmoothF

Override default smoothing function

Public variable

TFunction< doub...

 

CustomSmoothSpeedF

Override constant SmoothSpeedT with function

Protected variable

int

 

MaxEdgeID

Public variable

double

 

MaxEdgeLength

Maximum target edge length. Edges longer than this will be split if possible.

Public variable

double

 

MinEdgeLength

Minimum target edge length. Edges shorter than this will be collapsed if possible.

Public variable

int

 

ModifiedEdgesLastPass

Number of edges that were modified in previous Remesh pass.

Protected variable

const int

 

ModuloPrime

StartEdges() and GetNextEdge() control the iteration over edges that will be refined.

Public variable

double

 

SmoothSpeedT

Smoothing speed, in range [0,1]

Public variable

ESmoothTypes

 

SmoothType

Type of smoothing that will be applied unless overridden by CustomSmoothF

Protected variable

TArray< bool >

 

TempFlagBuffer

Protected variable

TDynamicVector<...

 

TempPosBuffer

Constructors

Name Description

Protected function

FRemesher()

Public function

FRemesher

(
    FDynamicMesh3* MeshIn
)

Public API

Functions

Name Description

Protected function Virtual

void

 

ApplyToProjectVertices

(
    const TFunction< void>& Verte...
)

Protected function Virtual

void

 

ApplyToSmoothVertices

(
    const TFunction< void>& Verte...
)

FullSmoothPass_Buffer this to calls VertexSmoothFunc for each vertex of the mesh.

Protected function Virtual

void

 

ApplyVertexBuffer

(
    bool bParallel
)

Public function Virtual

void

 

BasicRemeshPass()

Linear edge-refinement pass, followed by smoothing and projection

Protected function Virtual

FVector3d

 

ComputeSmoothedVertexPos

(
    int VertexID,
    TFunction< FVector3d...,
    bool& bModified
)

Computes smoothed vertex position w/ proper constraints/etc. Does not modify mesh.

Protected function Const

bool

 

EnableInlineProjection()

This just lets us write more concise code

Protected function Virtual

void

 

FullProjectionPass()

Project vertices onto projection target.

Protected function Virtual

void

 

FullSmoothPass_Buffer

(
    bool bParallel
)

Applies a smoothing pass to the mesh, storing intermediate positions in a buffer and then writing them at the end (so, no order effect)

Protected function Virtual

int

 

GetNextEdge

(
    int CurEdgeID,
    bool& bDone
)

Protected function Virtual

FVector3d

 

GetProjectedCollapsePosition

(
    int VertexID,
    const FVector3d& vNewPos
)

Used by collapse-edge to get projected position for new vertex

Protected function Virtual

TFunction< F...

 

GetSmoothFunction()

Returns the function we want to use to compute a smoothed vertex position - will be CustomSmoothF if set, otherwise one of cotan/meanvalue/uniform

Protected function Virtual

void

 

InitializeVertexBufferForPass()

Public function Virtual

void

 

OnEdgeCollapse

(
    int EdgeID,
    int VertexA,
    int VertexB,
    const FDynamicMesh3::FEdgeCollapseI...
)

Callback for subclasses to override to implement custom behavior

Public function Virtual

void

 

OnEdgeFlip

(
    int EdgeID,
    const FDynamicMesh3::FEdgeFlipInfo ...
)

Callback for subclasses to override to implement custom behavior

Public function Virtual

void

 

OnEdgeSplit

(
    int EdgeID,
    int VertexA,
    int VertexB,
    const FDynamicMesh3::FEdgeSplitInfo...
)

Callbacks and in-progress informationCallback for subclasses to override to implement custom behavior

Public function Virtual

void

 

Precompute()

We can speed things up if we precompute some invariants.

Protected function Virtual

EProcessResu...

 

ProcessEdge

(
    int edgeID
)

Protected function Virtual

void

 

ProfileBeginCollapse()

Protected function Virtual

void

 

ProfileBeginFlip()

Protected function Virtual

void

 

ProfileBeginOps()

Protected function Virtual

void

 

ProfileBeginPass()

Protected function Virtual

void

 

ProfileBeginProject()

Protected function Virtual

void

 

ProfileBeginSmooth()

Protected function Virtual

void

 

ProfileBeginSplit()

Protected function Virtual

void

 

ProfileEndCollapse()

Protected function Virtual

void

 

ProfileEndFlip()

Protected function Virtual

void

 

ProfileEndOps()

Protected function Virtual

void

 

ProfileEndPass()

Protected function Virtual

void

 

ProfileEndProject()

Protected function Virtual

void

 

ProfileEndSmooth()

Protected function Virtual

void

 

ProfileEndSplit()

Protected function Virtual

void

 

ProjectVertex

(
    int VertexID,
    IProjectionTarget* UseTarget
)

Public function

void

 

SetTargetEdgeLength

(
    double fLength
)

Set min/max edge-lengths to sane values for given target edge length

Protected function Virtual

int

 

StartEdges()

Protected function Virtual

void

 

UpdateAfterSplit

(
    int edgeID,
    int va,
    int vb,
    const FDynamicMesh3::FEdgeSplitInfo...
)

After we split an edge, we have created a new edge and a new vertex.

Enums

Name

Description

Protected enum

EProcessResult

Public enum

ESmoothTypes

Built-in Smoothing types

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss