4 ms·
> It’s also where you start hitting ray coherency problems - if you shoot 8 rays in a batch at roughly the same area of the scene, it’s likely that they’ll beha
by dragontamer 6y ago
> It’s also where you start hitting ray coherency problems - if you shoot 8 rays in a batch at roughly the same area of the scene, it’s likely that they’ll behave similarly. But as soon as they hit an object and bounce they all head in different directions, and pretty quickly you end up with dead lanes.
This is solved with stream compaction.
http://www.cse.chalmers.se/~uffe/streamcompaction.pdf http://www.cse.chalmers.se/~uffe/streamcompaction.pdf
There's only two states you need to "compact" into:
* Hits -- These rays will "recurse" and continue bouncing.
* Miss -- These rays will sample the "background" (either a set color, or maybe a HDRI map or something).
Collect hits together through stream-compaction. Then collect misses together through stream-compaction. Once the "hits" queue is empty, process all Misses together.