Choose your operating system:
Windows
macOS
Linux
Module |
|
Header |
/Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Public/Remesher.h |
Include |
#include "Remesher.h" |
class FRemesher : public UE::Geometry::FMeshRefinerBase
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 | Description | ||
---|---|---|---|
|
bEnableCollapses |
Controls whether edge collapses are allowed during remeshing pass |
|
|
bEnableFlips |
Configuration variables and flagsControls whether edge-flips are allowed during remeshing pass |
|
|
bEnableParallelProjection |
Enable parallel projection. Only applied in AfterRefinement mode |
|
|
bEnableParallelSmooth |
Enable parallel smoothing. |
|
|
bEnableSmoothing |
Controls whether vertex smoothing is applied during remeshing pass |
|
|
bEnableSmoothInPlace |
If smoothing is done in-place, we don't need an extra buffer, but also there will some randomness introduced in results. |
|
|
bEnableSplits |
Controls whether edge splits are allowed during remeshing pass |
|
|
bMeshIsClosed |
We can avoid some checks/etc if we know that the mesh has no boundary edges. |
|
|
bPreventNormalFlips |
Controls whether we try to prevent normal flips inside operations and smoothing. |
|
|
int |
COUNT_COLLAPSES |
|
|
int |
COUNT_FLIPS |
|
|
int |
COUNT_SPLITS |
Testing/debug/profiling stuff profiling functions, turn on ENABLE_PROFILING to see output in console |
|
CustomSmoothF |
Override default smoothing function |
|
|
TFunction< doub... |
CustomSmoothSpeedF |
Override constant SmoothSpeedT with function |
|
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] |
|
SmoothType |
Type of smoothing that will be applied unless overridden by CustomSmoothF |
|
|
TempFlagBuffer |
||
|
TDynamicVector<... |
TempPosBuffer |
Name | Description | |
---|---|---|
|
FRemesher() |
|
|
FRemesher ( |
Public API |
Name | Description | |
---|---|---|
|
~FRemesher() |
Name | Description | ||
---|---|---|---|
|
ApplyToProjectVertices |
Apply the given projection function to all vertices in the mesh. |
|
|
ApplyToSmoothVertices |
FullSmoothPass_Buffer this to calls VertexSmoothFunc for each vertex of the mesh. |
|
|
ApplyVertexBuffer ( |
||
|
BasicRemeshPass() |
Linear edge-refinement pass, followed by smoothing and projection |
|
|
ComputeSmoothedVertexPos |
Computes smoothed vertex position w/ proper constraints/etc. Does not modify mesh. |
|
|
EnableInlineProjection() |
This just lets us write more concise code |
|
|
FullProjectionPass ( |
Project vertices onto projection target. |
|
|
FullSmoothPass_Buffer ( |
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 ( |
|
|
GetProjectedCollapsePosition ( |
Used by collapse-edge to get projected position for new vertex |
|
|
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 |
|
|
InitializeVertexBufferForPass() |
||
|
MoveVerticesParallel |
Move all vertices in parallel. |
|
|
OnEdgeCollapse ( |
Callback for subclasses to override to implement custom behavior |
|
|
OnEdgeFlip ( |
Callback for subclasses to override to implement custom behavior |
|
|
OnEdgeSplit ( |
Callbacks and in-progress informationCallback for subclasses to override to implement custom behavior |
|
|
Precompute() |
We can speed things up if we precompute some invariants. |
|
|
EProcessResu... |
ProcessEdge ( |
|
|
ProfileBeginCollapse() |
||
|
ProfileBeginFlip() |
||
|
ProfileBeginOps() |
||
|
ProfileBeginPass() |
||
|
ProfileBeginProject() |
||
|
ProfileBeginSmooth() |
||
|
ProfileBeginSplit() |
||
|
ProfileEndCollapse() |
||
|
ProfileEndFlip() |
||
|
ProfileEndOps() |
||
|
ProfileEndPass() |
||
|
ProfileEndProject() |
||
|
ProfileEndSmooth() |
||
|
ProfileEndSplit() |
||
|
ProjectVertex ( |
Project a single vertex using the given target. |
|
|
SetTargetEdgeLength ( |
Set min/max edge-lengths to sane values for given target edge length |
|
|
int |
StartEdges() |
|
|
UpdateAfterSplit ( |
After we split an edge, we have created a new edge and a new vertex. |
Name |
Description |
|
---|---|---|
|
EFlipMetric |
Available Edge Flip metrics |
|
EProcessResult |
|
|
ESmoothTypes |
Built-in Smoothing types |