as the topic, could some one explain that for me, a little bit confused, there is a limit about the recursion depth and the value is 31. is there any limit for maximum ray trace depth? thank you very much!
What different means between the words "maximum ray trace depth" and "recursion depth" in OptiX programming guid
The terms “maximum trace depth” and “recursion depth” mean the same thing in the OptiX Programming Guide. This depth is referring to the depth of recursive calls made from
optixTrace() in one of your shader programs. The trace depth controls how much stack space is allocated for ray tracing, since you need one stack frame per recursive call, and so allowing for a high recursion limit might use a lot of stack space. Note that trace depth does not refer to the maximum length of a ray path when path tracing, because you can optionally use an iterative path tracing algorithm, rather than a recursive one. Iterative is recommended when possible because you can have a trace depth of 1 regardless of your path depth, which minimizes your stack usage. An iterative algorithm will call
optixTrace() from the
raygen program rather than from
any-hit. You can find an example of an iterative path tracer in our SDK sample called
For completeness, there is a separate “maximum traversal depth” concept in OptiX as well. This refers to the depth of your scene hierarchy, for example if you have instances of instances, your traversal depth might be 3. This is independent of the trace depth, but certainly sounds somewhat similar and might be easy to mix up.
Apologies for the delayed reply, I only just saw your message. If you have more OptiX questions, I invite you to post in the OptiX forum.