Navigation
API > API/Plugins > API/Plugins/DynamicMesh
Inheritance Hierarchy
- FMeshRefinerBase
- FRemesher
- FQueueRemesher
- FNormalFlowRemesher
- FSubRegionRemesher
- FRestrictedSubRegionRemesher
References
| Module | DynamicMesh |
| Header | /Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Public/Remesher.h |
| Include | #include "Remesher.h" |
Syntax
class FRemesher : public UE::Geometry::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
| Type | Name | Description | |
|---|---|---|---|
| bool | bEnableCollapses | Controls whether edge collapses are allowed during remeshing pass | |
| bool | bEnableFlips | Configuration variables and flagsControls whether edge-flips are allowed during remeshing pass | |
| bool | bEnableParallelProjection | Enable parallel projection. Only applied in AfterRefinement mode | |
| bool | bEnableParallelSmooth | Enable parallel smoothing. | |
| bool | bEnableSmoothing | Controls whether vertex smoothing is applied during remeshing pass | |
| bool | bEnableSmoothInPlace | If smoothing is done in-place, we don't need an extra buffer, but also there will some randomness introduced in results. | |
| bool | bEnableSplits | Controls whether edge splits are allowed during remeshing pass | |
| bool | bMeshIsClosed | We can avoid some checks/etc if we know that the mesh has no boundary edges. | |
| bool | bPreventNormalFlips | Controls whether we try to prevent normal flips inside operations and smoothing. | |
| bool | bPreventTinyTriangles | Controls whether we disallow creation of triangles with small areas inside edge operations. | |
| int | COUNT_COLLAPSES | ||
| int | COUNT_FLIPS | ||
| int | COUNT_SPLITS | Testing/debug/profiling stuff profiling functions, turn on ENABLE_PROFILING to see output in console | |
| TFunction< FVector3d(const FDynamicMesh3 &, int, double)> | CustomSmoothF | Override default smoothing function | |
| TFunction< double(const FDynamicMesh3 &, int)> | CustomSmoothSpeedF | Override constant SmoothSpeedT with function | |
| EFlipMetric | FlipMetric | Type of flip metric that will be applied | |
| int | MaxEdgeID | ||
| double | MaxEdgeLength | Maximum target edge length. Edges longer than this will be split if possible. | |
| double | MinEdgeLength | Minimum target edge length. Edges shorter than this will be collapsed if possible. | |
| double | MinLengthFlipThresh | For MinEdgeLength metric, only flip if NewLength < (MinLengthFlipThresh * CurLength) | |
| int | ModifiedEdgesLastPass | Number of edges that were modified in previous Remesh pass. | |
| const int | ModuloPrime | StartEdges() and GetNextEdge() control the iteration over edges that will be refined. | |
| double | SmoothSpeedT | Smoothing speed, in range [0,1] | |
| ESmoothTypes | SmoothType | Type of smoothing that will be applied unless overridden by CustomSmoothF | |
| TArray< bool > | TempFlagBuffer | ||
| TDynamicVector< FVector3d > | TempPosBuffer |
Constructors
| Type | Name | Description | |
|---|---|---|---|
FRemesher () |
|||
FRemesher
(
FDynamicMesh3* MeshIn |
Public API |
Destructors
| Type | Name | Description | |
|---|---|---|---|
~FRemesher () |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | ApplyToProjectVertices
(
const TFunction< void(int)>& VertexProjectFunc |
Apply the given projection function to all vertices in the mesh. | |
| void | ApplyToSmoothVertices
(
const TFunction< void(int)>& VertexSmoothFunc |
FullSmoothPass_Buffer this to calls VertexSmoothFunc for each vertex of the mesh. | |
| void | ApplyVertexBuffer
(
bool bParallel |
||
| void | Linear edge-refinement pass, followed by smoothing and projection | ||
| FVector3d | ComputeSmoothedVertexPos
(
int VertexID, |
Computes smoothed vertex position w/ proper constraints/etc. Does not modify mesh. | |
| bool | This just lets us write more concise code | ||
| void | FullProjectionPass
(
bool bParallel |
Project vertices onto projection target. | |
| 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) | |
| int | GetNextEdge
(
int CurEdgeID, |
||
| FVector3d | GetProjectedCollapsePosition
(
int VertexID, |
Used by collapse-edge to get projected position for new vertex | |
| TFunction< FVector3d(const FDynamicMesh3 &, int, double)> | Returns the function we want to use to compute a smoothed vertex position - will be CustomSmoothF if set, otherwise one of cotan/meanvalue/uniform | ||
| void | |||
| void | MoveVerticesParallel
(
TFunction< FVector3d(int, bool&)> NewVertexPosition |
Move all vertices in parallel. | |
| void | OnEdgeCollapse
(
int EdgeID, |
Callback for subclasses to override to implement custom behavior | |
| void | OnEdgeFlip
(
int EdgeID, |
Callback for subclasses to override to implement custom behavior | |
| void | OnEdgeSplit
(
int EdgeID, |
Callbacks and in-progress informationCallback for subclasses to override to implement custom behavior | |
| void | Precompute () |
We can speed things up if we precompute some invariants. | |
| EProcessResult | ProcessEdge
(
int edgeID |
||
| void | |||
| void | |||
| void | |||
| void | |||
| void | |||
| void | |||
| void | |||
| void | |||
| void | |||
| void | |||
| void | |||
| void | |||
| void | |||
| void | |||
| void | ProjectVertex
(
int VertexID, |
Project a single vertex using the given target. | |
| void | SetTargetEdgeLength
(
double fLength |
Set min/max edge-lengths to sane values for given target edge length | |
| int | StartEdges () |
||
| void | UpdateAfterSplit
(
int edgeID, |
After we split an edge, we have created a new edge and a new vertex. |
Enums
| Type | Name | Description | |
|---|---|---|---|
| EFlipMetric | Available Edge Flip metrics | ||
| EProcessResult | |||
| ESmoothTypes | Built-in Smoothing types |