TECHNOLOGY

OptiX stack sizing: distinguish nested trace calls from light-path length

In this article
THE QUICK TAKE

The number of physical light bounces is not necessarily the maximum nesting depth of trace calls in the shader program.

Inspect the program’s call structure

A renderer can trace a long light path iteratively from a ray-generation program or recursively from hit programs. Those implementations can describe similar physical transport while requiring different execution stacks. A configuration field called depth is therefore ambiguous without context. Identify nested trace calls, continuation callables and direct callables in the actual program before translating a rendering-quality setting into pipeline stack requirements or deciding that a stack failure proves the scene is too complex.

Separate trace nesting from path bounces

The OptiX host API describes stack configuration and maximum trace-call depth. Count the deepest actual nesting, including paths that launch a shadow query from inside another program. An iterative path loop can accumulate many surface interactions without the same recursion pattern. Increasing a physical bounce limit does not automatically establish a corresponding stack-size formula; inspect how that setting changes the executed shader control flow.

Track traversable depth independently

The same API distinguishes traversable-graph depth, including acceleration structures and motion transforms. This is not the number of nodes visited inside a geometry BVH. The type declarations separately define stack-size components for program kinds and pipeline options. Preserve these concepts as distinct configuration inputs. A scene with additional instance or transform levels can change traversal requirements even if the shader’s recursive call structure and physical sampling budget remain unchanged.

Use helpers appropriate to the linked programs

The SDK stack helpers provide accumulation and calculation mechanisms based on program-group stack requirements and declared call depths. Use the helpers matching the installed SDK, and keep their input set consistent with programs actually linked into the pipeline. A value copied from a small sample application may omit callable paths or program kinds present in a production renderer. Revisit configuration when changing shader composition, rather than only after a visible failure.

Exercise the deepest valid paths

Create diagnostic cases covering the intended trace nesting, callable usage and instance graph. Check validation output under the current SDK and compare measured rendering behavior before and after configuration changes. The guides to path termination and GPU BVH traversal explain adjacent concepts. Correct sizing follows the program and traversal contracts; blindly treating every depth setting as the same number can either miss a required stack path or obscure the actual source of an error.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles