![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <SparseNarrowBandMeshSDF.h>
Classes | |
| struct | FScatterCounter |
| struct | FTriBBox |
| struct | FTriIDBlockGrid |
Public Types | |
| enum | EComputeModes { NarrowBandOnly = 1 , NarrowBand_SpatialFloodFill = 2 } |
| enum | EInsideModes { CrossingCount = 0 , WindingCount = 1 } |
Public Member Functions | |
| TSparseNarrowBandMeshSDF (const TriangleMeshType *Mesh=nullptr, float CellSize=1.f, TMeshAABBTree3< TriangleMeshType > *Spatial=nullptr) | |
| TTriLinearGridInterpolant< TSparseNarrowBandMeshSDF > | MakeInterpolant () |
| bool | Validate (const FAxisAlignedBox3d &Bounds) |
| bool | Compute (FAxisAlignedBox3d Bounds) |
| FVector3i | Dimensions () const |
| const FBlockedGrid3i & | GetClosestTriGrid () const |
| const FBlockedGrid3i & | GetIntersectionsGrid () const |
| float | At (int32 I, int32 J, int32 K) const |
| float | operator[] (const FVector3i &ijk) const |
| float | GetValue (const FVector3i &ijk) const |
| FVector3f | CellCenter (int32 I, int32 J, int32 K) const |
Static Public Member Functions | |
| static bool | ShouldUseSpatial (int32 ExactCells, double CellSize, double AvgEdgeLen) |
Public Attributes | |
| const TriangleMeshType * | Mesh = nullptr |
| TMeshAABBTree3< TriangleMeshType > * | Spatial = nullptr |
| TUniqueFunction< bool(const FVector3d &)> | IsInsideFunction |
| float | CellSize |
| int | ExactBandWidth = 1 |
| FVector3d | ExpandBounds = FVector3d::Zero() |
| bool | bUseParallel = true |
| int | ApproxMaxCellsPerDimension = 4096 |
| EComputeModes | ComputeMode = EComputeModes::NarrowBandOnly |
| double | NarrowBandMaxDistance = 0 |
| bool | bComputeSigns = true |
| EInsideModes | InsideMode = EInsideModes::WindingCount |
| bool | bWantClosestTriGrid = false |
| bool | bWantIntersectionsGrid = true |
| TFunction< bool()> | CancelF |
| FVector3f | GridOrigin |
| FBlockedGrid3f | Grid |
Protected Attributes | |
| FBlockedGrid3i | ClosestTriGrid |
| FBlockedGrid3i | IntersectionsGrid |
Compute discretely-sampled (ie gridded) signed distance field for a mesh within a specified narrow band.
The basic approach is, first compute exact Distances in a narrow band, and then The resulting unsigned Grid is then signed using ray-intersection counting, which is also computed on the Grid, so no BVH is necessary
The underlying grid data structures are blocked grids where spatial blocks are allocated as needed, so the memory footprint will generally be much lower than the TSweepingMeshSDF, or TCachingMeshSDF. But if distances in the full grid domain are desired (not just a narrow band), then the TSweepingMeshSDF should be used.
You can optionally provide a spatial data structure to allow faster computation of narrow-band Distances; this is most beneficial if we want a wider band
Caveats:
This code is based on the implementation found at https://github.com/christopherbatty/SDFGen
| enum UE::Geometry::TSparseNarrowBandMeshSDF::EComputeModes |
| enum UE::Geometry::TSparseNarrowBandMeshSDF::EInsideModes |
|
inline |
| Mesh | Triangle mesh to build an SDF around |
| CellSize | Spacing between Grid points |
| Spatial | Optional AABB tree; note it must be provided if ComputeMode is set to NarrowBand_SpatialFloodFill |
|
inline |
|
inline |
|
inline |
Compute the SDF
| Bounds | Bounding box for the mesh data (passed as param it is usually already available, depending on TriangleMeshType and whether an AABB tree was provided) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
Encodes heuristic for deciding whether it will be faster to use
|
inline |
| int UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::ApproxMaxCellsPerDimension = 4096 |
| bool UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::bComputeSigns = true |
| bool UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::bUseParallel = true |
| bool UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::bWantClosestTriGrid = false |
| bool UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::bWantIntersectionsGrid = true |
| TFunction<bool()> UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::CancelF |
if this function returns true, the calculation will abort
| float UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::CellSize |
|
protected |
| EComputeModes UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::ComputeMode = EComputeModes::NarrowBandOnly |
| int UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::ExactBandWidth = 1 |
| FVector3d UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::ExpandBounds = FVector3d::Zero() |
| FBlockedGrid3f UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::Grid |
| FVector3f UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::GridOrigin |
| EInsideModes UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::InsideMode = EInsideModes::WindingCount |
|
protected |
| TUniqueFunction<bool(const FVector3d&)> UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::IsInsideFunction |
| const TriangleMeshType* UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::Mesh = nullptr |
| double UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::NarrowBandMaxDistance = 0 |
| TMeshAABBTree3<TriangleMeshType>* UE::Geometry::TSparseNarrowBandMeshSDF< TriangleMeshType >::Spatial = nullptr |