Navigation
API > API/Plugins > API/Plugins/DynamicMesh > API/Plugins/DynamicMesh/Operations
References
| Module | DynamicMesh |
| Header | /Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Public/Operations/SmoothDynamicMeshAttributes.h |
| Include | #include "Operations/SmoothDynamicMeshAttributes.h" |
Syntax
class FSmoothDynamicMeshAttributes
Remarks
Smooth scalar data of any dimension that is stored via TDynamicMeshOverlay. The operator doesn't know anything about constraints that are associated with the actual overlay type. For example, if the overlay contains unit length normals, the resulting "smoothed" normals might not have unit length.
The smoothing happens in stages:
- First, we average the overlay element values at each vertex to obtain the per-vertex values.
- For each vertex, we compute the weighted average of its connected neighbors using the EdgeWeightMethod weights. The smoothed value equals the (1-Strength)*PerVertexValue + (Strength)*NeighborAverage. Strength is expected to be in the zero to one range, otherwise the operation can turn from smoothing to more of an unsharp filter. We repeat this NumIterations times.
- Finally, the smoothed per-vertex values are written back to the overlay by either overwriting the content of all per-vertex elements (SplitVertexModel == ESplitVertexModel::SetAllToSmoothed) or blending on per-element basis using the BlendWithSmoothedStrength blend value. The calling code could use FSplitAttributeWelder to weld split-attributes that happen to have identical values after this smoothing (happens when the SplitVertexModel == ESplitVertexModel::SetAllToSmoothed).
Example Usage:
// Smoothing the color FDynamicMesh3 Mesh = ... FDynamicMeshColorOverlay* Colors = Mesh.Attributes()->PrimaryColors();
FSmoothDynamicMeshAttributes BlurOp(&Mesh);
// Setup the parameters BlurOp.bUseParallel = true; BlurOp.NumIterations = 10; BlurOp.Strength = 0.2; BlurOp.EdgeWeightMethod = EEdgeWeights::CotanWeights;
// Run the smoothing BlurOp.SmoothOverlay(Colors);
Variables
| Type | Name | Description | |
|---|---|---|---|
| double | BlendWithSmoothedStrength | Control the amount of blending between the final smoothed value and the original element value. | |
| bool | bUseParallel | Enable/disable multi-threading. | |
| TArray< double > | CotangentEdgeWeights | ||
| double | EdgeLengthThreshold | ||
| TArray< double > | EdgeLengthWeights | ||
| EEdgeWeights | EdgeWeightMethod | ||
| TArray< int32 > | ExpandedSelection | If Selection array is not empty, will contain all vertices in Selection plus one-ring neighbors for each vertex. | |
| const FDynamicMesh3 * | Mesh | ||
| int32 | NumIterations | The number of smoothing iterations. | |
| FProgressCancel * | Progress | Optional Inputs Set this to be able to cancel the running operation. | |
| TArray< int32 > | Selection | Subset of points to smooth. | |
| ESplitVertexModel | SplitVertexModel | ||
| double | Strength | The strength of each smoothing iteration. | |
| TMap< int32, int32 > | VIDToExpandedSelectionIdx | Maps mesh Vertex ID to ExpandedSelection index. |
Constructors
| Type | Name | Description | |
|---|---|---|---|
FSmoothDynamicMeshAttributes
(
const FDynamicMesh3& InMesh |
Destructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| bool | Cancelled () |
||
| int32 | MeshVIDToSelectionIdx
(
int32 VertexID |
||
| bool | SmoothOverlay
(
TDynamicMeshOverlay< RealType, ElementSize >* InOverlay, |
Enums
| Type | Name | Description | |
|---|---|---|---|
| EEdgeWeights | |||
| ESplitVertexModel | How to deal with the split vertices. |