![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <MeshBoolean.h>
Classes | |
| struct | FCustomInsideMeshTest |
| struct | FCustomInsideTestContext |
Public Types | |
| enum class | EBooleanOp { Union , Difference , Intersect , TrimInside , TrimOutside , NewGroupInside , NewGroupOutside } |
| using | TestInsideFunctionType = TFunction< bool(const FVector3d &TestPosition, const FCustomInsideTestContext &Context)> |
Public Member Functions | |
| FMeshBoolean (const FDynamicMesh3 *MeshA, const FTransformSRT3d &TransformA, const FDynamicMesh3 *MeshB, const FTransformSRT3d &TransformB, FDynamicMesh3 *OutputMesh, EBooleanOp Operation) | |
| FMeshBoolean (const FDynamicMesh3 *MeshA, const FDynamicMesh3 *MeshB, FDynamicMesh3 *OutputMesh, EBooleanOp Operation) | |
| virtual | ~FMeshBoolean () |
| EOperationValidationResult | Validate () |
| GEOMETRYCORE_API bool | Compute () |
| GEOMETRYCORE_API bool | ComputeWithCustomInside (FCustomInsideMeshTest TestMeshA, FCustomInsideMeshTest TestMeshB) |
Protected Member Functions | |
| virtual bool | Cancelled () |
MeshBoolean – perform a boolean operation on two input meshes.
| using UE::Geometry::FMeshBoolean::TestInsideFunctionType = TFunction<bool(const FVector3d& TestPosition, const FCustomInsideTestContext& Context)> |
|
strong |
|
inline |
Perform a boolean operation to combine two meshes into a provided output mesh.
| MeshA | First mesh to combine |
| TransformA | Transform of MeshA |
| MeshB | Second mesh to combine |
| TransformB | Transform of MeshB |
| OutputMesh | Mesh to store output |
| Operation | How to combine meshes |
|
inline |
|
inlinevirtual |
If this returns true, abort computation.
| bool FMeshBoolean::Compute | ( | ) |
Compute the Boolean operation, using winding number for inside/outside tests
| bool FMeshBoolean::ComputeWithCustomInside | ( | FCustomInsideMeshTest | TestMeshA, |
| FCustomInsideMeshTest | TestMeshB | ||
| ) |
Compute the Boolean operation with a custom function determining if points are inside the given mesh
|
inline |
| TSet<int32> UE::Geometry::FMeshBoolean::AllNewEdges |
All edges created by mesh boolean algorithm. Only populated if bTrackAllNewEdges = true
Whether to do additional processing to try to remove degenerate edges
When doing an operation that merges two meshes (Union, Difference, Intersect) and bPopulateSecondMeshGroupMap is true, we populate a map from group ID's in the second mesh to group ID's in the result. Useful when the boolean is part of another operation that might want to track selection into the result.
TODO: It would be nice to have a similar triangle map, but it's more tedious to implement due to the mesh cuts that happen. We might also someday want something similar for the first mesh, where the group ID's will usually stay the same except when all triangles of a particular group are removed and the group ID is repurposed for the second mesh...
Prevent simplification from distorting overlay UVs
Prevent simplification from distorting triangle groups
Prevent simplification from distorting vertex normals
Prevent simplification from distorting vertex UVs
Put the Result mesh in the same space as the input. If true, ResultTransform will be the identity transform.
Control whether we attempt to auto-simplify the small planar triangles that the boolean operation tends to generate
Control whether new edges should be tracked
Weld newly-created cut edges where the input meshes meet. If false, the input meshes will remain topologically disconnected.
| TArray<int> UE::Geometry::FMeshBoolean::CreatedBoundaryEdges |
Boundary edges created by the mesh boolean algorithm failing to cleanly weld (doesn't include boundaries that already existed in source meshes)
| double UE::Geometry::FMeshBoolean::DegenerateEdgeTolFactor = 1.5 |
Tolerance factor (multiplied by SnapTolerance) for removing short edges created by the cutting process; should be no more than 2
| const FDynamicMesh3* UE::Geometry::FMeshBoolean::Meshes[2] |
| float UE::Geometry::FMeshBoolean::NormalDistortTolerance = .01f |
When preserving normals, sets maximum allowed change in normals from collapsing an edge, measured at the removed vertex in degrees
| EBooleanOp UE::Geometry::FMeshBoolean::Operation |
| int UE::Geometry::FMeshBoolean::PreserveUVsOnlyForMesh = -1 |
If > -1, then only preserve the UVs of one of the input meshes. Useful when cutting an artist-created asset w/ procedural geometry.
| FProgressCancel* UE::Geometry::FMeshBoolean::Progress = nullptr |
Set this to be able to cancel running operation
| FDynamicMesh3* UE::Geometry::FMeshBoolean::Result |
| FTransformSRT3d UE::Geometry::FMeshBoolean::ResultTransform |
Transform taking the result mesh back to the original space of the inputs
| FIndexMapi UE::Geometry::FMeshBoolean::SecondMeshGroupMap |
| double UE::Geometry::FMeshBoolean::SimplificationAngleTolerance = .1 |
Degrees of deviation from coplanar that we will still simplify
| double UE::Geometry::FMeshBoolean::SnapTolerance = FMathf::ZeroTolerance * 1.0 |
Tolerance distance for considering a point to be on a vertex or edge, especially during mesh-mesh cutting
| const FTransformSRT3d UE::Geometry::FMeshBoolean::Transforms[2] |
| double UE::Geometry::FMeshBoolean::TryToImproveTriQualityThreshold = .5 |
If triangle quality (aspect ratio) is worse than this threshold, only simplify in ways that improve quality. If <= 0, triangle quality is ignored. Note: For aspect ratio we use definition: 4*TriArea / (sqrt(3)*MaxEdgeLen^2), ref: https://people.eecs.berkeley.edu/~jrs/papers/elemj.pdf p.53 Equilateral triangles have value 1; Smaller values -> lower quality
| float UE::Geometry::FMeshBoolean::UVDistortTolerance = FMathf::ZeroTolerance |
When preserving UVs, sets maximum allowed change in UV coordinates from collapsing an edge, measured at the removed vertex
| double UE::Geometry::FMeshBoolean::WindingThreshold = .5 |
Threshold to determine whether triangle in one mesh is inside or outside of the other