Fix GPU-based SDF generation to reject negative distance from far away triangles
This commit is contained in:
BIN
Content/Shaders/SDF.flax
(Stored with Git LFS)
BIN
Content/Shaders/SDF.flax
(Stored with Git LFS)
Binary file not shown.
@@ -142,6 +142,8 @@ void CS_RasterizeTriangle(uint3 DispatchThreadId : SV_DispatchThreadID)
|
||||
int voxelIndex = GetVoxelIndex(voxelCoord);
|
||||
float3 voxelPos = GetVoxelPos(voxelCoord);
|
||||
float distance = SignedDistancePointToTriangle(voxelPos, v0, v1, v2);
|
||||
if (distance < -10.0f) // TODO: find a better way to reject negative distance from degenerate triangles that break SDF shape
|
||||
distance = abs(distance);
|
||||
InterlockedMin(SDF[voxelIndex], FloatFlip3(distance));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user