Identify the ray tracing problem

Imagine a ray passing through a tree filled with hundreds of leaves. Each leaf might be a rectangular mesh with a texture that makes most of that rectangle transparent. The ray can therefore intersect the rectangle without hitting the visible part of the leaf.

The renderer must check the leaf’s alpha mask before it accepts the intersection. One check is inexpensive, but the work adds up when shadow and reflection rays pass through many layers of foliage, fences, or grilles.

Opacity Micromaps (OMM) move much of this decision into ray traversal. OMM stores a simplified description of the alpha mask in a form that the traversal hardware can read. This can prevent the renderer from running shader-side material logic for every candidate intersection.

Separate geometry from opacity

A leaf often uses a quad made from two triangles. The geometry describes the complete rectangle, while an alpha texture cuts the leaf shape out of it. It helps to treat these as two separate layers of information:

Data layerQuestion it answers
GeometryWhere can a ray intersect a triangle?
OpacityIs the intersected position visible?

Image Alt Text:Three-panel diagram showing a ray intersecting a leaf quad. Geometry reports a hit on the complete rectangle, while the alpha mask shows whether that point is part of the visible leaf.Geometry and alpha provide separate answers for the same ray intersection

The figure shows a candidate hit on the visible leaf. The geometry test reports a triangle hit, and the alpha mask confirms that the position is opaque. Other positions on the same quad can be transparent, so traversal still needs an opacity decision. OMM helps the traversal hardware make that decision earlier.

Compare rasterization and ray traversal

You might already handle this kind of material with alpha testing during rasterization. Ray tracing solves the same visual problem at a different point in the rendering process. Rasterization creates a fragment before the pixel shader checks the alpha texture. Ray traversal finds a possible triangle intersection before it knows whether that point is visible.

Rendering pathOpacity decision
RasterizationA pixel shader samples alpha and discards the fragment when it fails the cutoff.
Ray tracing without OMMAn any-hit shader or ray-query candidate handler evaluates the mask.
Ray tracing with OMMTraversal resolves known regions and keeps only unknown regions for shader-side evaluation.

A shadow or reflection ray can pass through several overlapping leaves. Without OMM, each possible hit can repeat texture access, material setup, and control flow. With OMM, traversal first reads a compact state for the small region that the ray hit:

OMM stateTraversal action
OpaqueAccept the region as opaque.
TransparentIgnore the region and continue traversal.
UnknownKeep the candidate for shader-side evaluation.

Identify suitable assets

Not every alpha-tested asset benefits from OMM. You get the clearest value when the opacity pattern remains stable and most of the mask can be classified before the game runs. Use the following examples as a starting point when you review an asset:

Asset patternOMM fitEvidence to check
Static foliageStrong candidateStable mask, repeated ray hits, and narrow alpha edges
Chain-link fence or grilleStrong candidateStable binary cutouts and enough subdivision for thin features
Animated or changing maskConditionalA defined update or rebuild policy
Alpha-blended surfacePoor candidateContinuous transparency needs a blending path.
Rasterization-only assetNo benefitThe asset never participates in ray traversal.

Also check every mesh level of detail (LOD) separately. Its UV coordinates, triangle links, and alpha data need to match the version that’s used to create the OMM. Otherwise, valid OMM data can become attached to the wrong triangle and produce incorrect opacity results.

Before continuing, choose one alpha-tested asset from your own project. Alternatively, picture a common example, such as a leaf or wire fence.

Ask three questions about the asset:

  • Does the asset participate in ray tracing?
  • Does the alpha mask of the asset remain stable?
  • Will rays cross the asset often enough for repeated opacity checks to matter?

If the answer to all three questions is yes, the asset is a reasonable OMM candidate. Keep dynamic masks and assets with mostly uncertain opacity on the existing shader-side path until profiling gives you a reason to change them.

What you’ve learned and what’s next

You’ve learned how to distinguish the geometry intersection from the opacity decision and identify assets that are reasonable OMM candidates.

Next, you’ll choose how microtriangles represent the asset’s opacity.

Back
Next