Increase the bounding box for numerical stability
This commit is contained in:
parent
dafc612b68
commit
bc5bf8ca7b
1 changed files with 8 additions and 0 deletions
|
|
@ -561,6 +561,14 @@ int CPUBottomLevelAccelStruct::Subdivide(int *triangles, int num_triangles, cons
|
|||
}
|
||||
median /= (float)num_triangles;
|
||||
|
||||
// For numerical stability
|
||||
min.X -= 0.1f;
|
||||
min.Y -= 0.1f;
|
||||
min.Z -= 0.1f;
|
||||
max.X += 0.1f;
|
||||
max.Y += 0.1f;
|
||||
max.Z += 0.1f;
|
||||
|
||||
if (num_triangles == 1) // Leaf node
|
||||
{
|
||||
nodes.push_back(Node(min, max, triangles[0] * 3));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue