Navigation
API > API/Plugins > API/Plugins/DynamicMesh
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);
| Name | FSmoothDynamicMeshAttributes |
| Type | class |
| Header File | /Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Public/Operations/SmoothDynamicMeshAttributes.h |
| Include Path | #include "Operations/SmoothDynamicMeshAttributes.h" |
Syntax
class FSmoothDynamicMeshAttributes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FSmoothDynamicMeshAttributes
(
const FDynamicMesh3& InMesh |
Operations/SmoothDynamicMeshAttributes.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~FSmoothDynamicMeshAttributes() |
Operations/SmoothDynamicMeshAttributes.h |
Enums
Public
| Name | Remarks |
|---|---|
| EEdgeWeights | |
| ESplitVertexModel | How to deal with the split vertices. |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| BlendWithSmoothedStrength | double | Control the amount of blending between the final smoothed value and the original element value. | Operations/SmoothDynamicMeshAttributes.h | |
| bUseParallel | bool | Enable/disable multi-threading. | Operations/SmoothDynamicMeshAttributes.h | |
| EdgeWeightMethod | EEdgeWeights | Operations/SmoothDynamicMeshAttributes.h | ||
| NumIterations | int32 | The number of smoothing iterations. | Operations/SmoothDynamicMeshAttributes.h | |
| Progress | FProgressCancel * | Optional Inputs Set this to be able to cancel the running operation. | Operations/SmoothDynamicMeshAttributes.h | |
| Selection | TArray< int32 > | Subset of points to smooth. | Operations/SmoothDynamicMeshAttributes.h | |
| SplitVertexModel | ESplitVertexModel | Operations/SmoothDynamicMeshAttributes.h | ||
| Strength | double | The strength of each smoothing iteration. | Operations/SmoothDynamicMeshAttributes.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool SmoothOverlay
(
TDynamicMeshOverlay< RealType, ElementSize >* InOverlay, |
Operations/SmoothDynamicMeshAttributes.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual bool Cancelled() |
Operations/SmoothDynamicMeshAttributes.h | ||
int32 MeshVIDToSelectionIdx
(
int32 VertexID |
Operations/SmoothDynamicMeshAttributes.h |