Hi, I am currently writing an OptiX pathtracer and I have all my sampling logic in the raygen program and in my closest hit program I only have texture evaluation and material/surface property fetching. Now I wanted to benefit from SER thus I wondered if I have to move all the sampling to the closest hit program or if raygen is also reordered. Any help much appreciated!
When using SER, you have an explicit call to optixReorder()
. Everything before the call is unordered and everything after it is ordered. In our examples, we typically call optixReorder()
before calling optixInvoke()
. Since optixInvoke()
triggers your closest-hit shader, the closest hit call will be reordered if optixReorder()
was called first. This also means that you can insert your own code in raygen in between the reorder call and the invoke call, and that code will also be reordered.
It’s fairly flexible and easy to use. The main things to pay attention to are how many of your variables are active before and after the reorder call, and whether your rendering algorithm has threads that exit at different times. You want to minimize the number of active registers, and try to keep work on either side of reorder separated as much as possible. This isn’t a rule, just something to aim for, and it’s not always easy or possible. For threads exiting early, try to give your reorder call any hints about which threads might exit. For example, we see big speedups for people who put their russian roulette decision into the reorder hint, that will help keep the live threads grouped together.
–
David.
For more insight have a look here, including a long white paper OptiX 8.0 Release - Visualization / OptiX - NVIDIA Developer Forums.