Navigation
API > API/Plugins > API/Plugins/DynamicMesh
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.
| Name | FRemesher |
| Type | class |
| Header File | /Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Public/Remesher.h |
| Include Path | #include "Remesher.h" |
Syntax
class FRemesher : public UE::Geometry::FMeshRefinerBase
Inheritance Hierarchy
- FMeshRefinerBaseFixLayout → FMeshRefinerBase → FRemesher
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FRemesher () |
Remesher.h | ||
FRemesher
(
FDynamicMesh3* MeshIn |
Public API | Remesher.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~FRemesher() |
Remesher.h |
Enums
Public
| Name | Remarks |
|---|---|
| EFlipMetric | Available Edge Flip metrics |
| ESmoothTypes | Built-in Smoothing types |
Protected
| Name | Remarks |
|---|---|
| EProcessResult |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bEnableCollapses | bool | Controls whether edge collapses are allowed during remeshing pass | Remesher.h | |
| bEnableFlips | bool | Configuration variables and flags Controls whether edge-flips are allowed during remeshing pass | Remesher.h | |
| bEnableParallelProjection | bool | Enable parallel projection. Only applied in AfterRefinement mode | Remesher.h | |
| bEnableParallelSmooth | bool | Enable parallel smoothing. | Remesher.h | |
| bEnableSmoothing | bool | Controls whether vertex smoothing is applied during remeshing pass | Remesher.h | |
| bEnableSmoothInPlace | bool | If smoothing is done in-place, we don't need an extra buffer, but also there will some randomness introduced in results. | Remesher.h | |
| bEnableSplits | bool | Controls whether edge splits are allowed during remeshing pass | Remesher.h | |
| bPreventNormalFlips | bool | Controls whether we try to prevent normal flips inside operations and smoothing. | Remesher.h | |
| bPreventTinyTriangles | bool | Controls whether we disallow creation of triangles with small areas inside edge operations. | Remesher.h | |
| CustomEdgeLengthScaleF | TFunction< double(const FDynamicMesh3 &Mesh, int VertexA, int VertexB)> | Scale the computed edge length to allow for adaptive remeshing | Remesher.h | |
| CustomSmoothF | TFunction< FVector3d(const FDynamicMesh3 &, int, double)> | Override default smoothing function | Remesher.h | |
| CustomSmoothSpeedF | TFunction< double(const FDynamicMesh3 &, int)> | Override constant SmoothSpeedT with function | Remesher.h | |
| FlipMetric | EFlipMetric | Type of flip metric that will be applied | Remesher.h | |
| MaxEdgeLength | double | Maximum target edge length. Edges longer than this will be split if possible. | Remesher.h | |
| MinEdgeLength | double | Minimum target edge length. Edges shorter than this will be collapsed if possible. | Remesher.h | |
| MinLengthFlipThresh | double | For MinEdgeLength metric, only flip if NewLength < (MinLengthFlipThresh * CurLength) | Remesher.h | |
| ModifiedEdgesLastPass | int | Number of edges that were modified in previous Remesh pass. | Remesher.h | |
| SmoothSpeedT | double | Smoothing speed, in range [0,1] | Remesher.h | |
| SmoothType | ESmoothTypes | Type of smoothing that will be applied unless overridden by CustomSmoothF | Remesher.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void BasicRemeshPass () |
Linear edge-refinement pass, followed by smoothing and projection | Remesher.h | |
virtual void OnEdgeCollapse
(
int EdgeID, |
Callback for subclasses to override to implement custom behavior | Remesher.h | |
virtual void OnEdgeFlip
(
int EdgeID, |
Callback for subclasses to override to implement custom behavior | Remesher.h | |
virtual void OnEdgeSplit
(
int EdgeID, |
Callbacks and in-progress information Callback for subclasses to override to implement custom behavior | Remesher.h | |
virtual void Precompute () |
We can speed things up if we precompute some invariants. | Remesher.h | |
void SetTargetEdgeLength
(
double fLength |
Set min/max edge-lengths to sane values for given target edge length | Remesher.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void ApplyToProjectVertices
(
const TFunction< void(int)>& VertexProjectFunc |
Apply the given projection function to all vertices in the mesh. | Remesher.h | |
virtual void ApplyToSmoothVertices
(
const TFunction< void(int)>& VertexSmoothFunc |
FullSmoothPass_Buffer this to calls VertexSmoothFunc for each vertex of the mesh. | Remesher.h | |
virtual void ApplyVertexBuffer
(
bool bParallel |
Remesher.h | ||
virtual FVector3d ComputeSmoothedVertexPos
(
int VertexID, |
Computes smoothed vertex position w/ proper constraints/etc. Does not modify mesh. | Remesher.h | |
bool EnableInlineProjection() |
This just lets us write more concise code | Remesher.h | |
virtual void FullProjectionPass
(
bool bParallel |
Project vertices onto projection target. | Remesher.h | |
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) | Remesher.h | |
virtual int GetNextEdge
(
int CurEdgeID, |
Remesher.h | ||
virtual FVector3d GetProjectedCollapsePosition
(
int VertexID, |
Used by collapse-edge to get projected position for new vertex | Remesher.h | |
virtual TFunction< FVector3d(const FDynamicMesh3 &, int, double)> 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 | Remesher.h | |
virtual void InitializeVertexBufferForPass() |
Remesher.h | ||
void MoveVerticesParallel
(
TFunction< FVector3d(int, bool&)> NewVertexPosition |
Move all vertices in parallel. | Remesher.h | |
virtual EProcessResult ProcessEdge
(
int edgeID |
Remesher.h | ||
virtual void ProfileBeginCollapse() |
Remesher.h | ||
virtual void ProfileBeginFlip() |
Remesher.h | ||
virtual void ProfileBeginOps() |
Remesher.h | ||
virtual void ProfileBeginPass() |
Remesher.h | ||
virtual void ProfileBeginProject() |
Remesher.h | ||
virtual void ProfileBeginSmooth() |
Remesher.h | ||
virtual void ProfileBeginSplit() |
Remesher.h | ||
virtual void ProfileEndCollapse() |
Remesher.h | ||
virtual void ProfileEndFlip() |
Remesher.h | ||
virtual void ProfileEndOps() |
Remesher.h | ||
virtual void ProfileEndPass() |
Remesher.h | ||
virtual void ProfileEndProject() |
Remesher.h | ||
virtual void ProfileEndSmooth() |
Remesher.h | ||
virtual void ProfileEndSplit() |
Remesher.h | ||
virtual void ProjectVertex
(
int VertexID, |
Project a single vertex using the given target. | Remesher.h | |
virtual int StartEdges() |
Remesher.h | ||
virtual void UpdateAfterSplit
(
int edgeID, |
After we split an edge, we have created a new edge and a new vertex. | Remesher.h |