Developer Blog: Creating Optimal Meshes for Ray Tracing

Discuss (0)

When you are creating triangle meshes for ray tracing or reusing meshes that have been successfully used in rasterization-based rendering, there are some pitfalls that can cause surprising performance issues.

Some mesh properties that have been acceptable in rasterization can be problematic in ray tracing or require specific handling to work as expected. This post reveals those pitfalls and gives practical advice to get around them.

  • Avoid elongated triangles in meshes
  • Rebuild deformable meshes when needed
  • Be careful with degenerate triangles
  • Merge and split meshes judiciously
  • Optimize alpha tested meshes

Avoid elongated triangles in meshes

Thin and long, elongated triangles are rarely optimal in computer graphics, but they can be especially challenging for ray tracing acceleration structure building.

The acceleration structures are hierarchies of bounding volumes. The bounding volume of a long, thin mesh triangle contains a lot of empty space around the triangle and easily overlaps with many other triangles in the mesh. When tracing a ray against the mesh and traversing the acceleration structure, this leads to many failed intersection tests before finding the triangle that is hit by the ray (Figure 1).

On the left side, there is a long, thin triangle inside a bounding box with lots of empty space. On the right side, there is an evenly shaped triangle inside a bounding box with less empty space.
Figure 1. A simplified illustration of an elongated triangle and its bounding box compared to a more evenly shaped triangle and its bounding box. The bounding box of the elongated triangle contains more empty space compared to the size of the triangle.

Read the full post on the NVIDIA Developer Blog.