ordering primary rays back

Board: Home Board index Raytracing General Development

(L) [2013/09/28] [tby alidade] [ordering primary rays] Wayback!

How do you guys order your primary rays? If you shoot bundles, how do you order your bundles? By pixel row/ column? By quadtree / Morton number? By predetermined BVH data?
Related question- anyone implement any entry point space skipping procedure into the scene acceleration structure?
thanks
(L) [2014/01/27] [tby phkahler] [ordering primary rays] Wayback!

In the old day of ompf.org I posted something about this. I was doing single rays even for the camera and found that shooting rays in Z-order (depth first quad tree order) resulted in some percent performance increase. i think it was between 7 and 9 percent for what I was doing at the time. The reason is simple cache performance. If you have a 1024 pixel wide image and go in scan line order, you'll have 1024 rays spread over a large portion of the scene and traversal structure. That means data needed at the start of the next line may have been discarded and need to be reloaded. If you go with Z order (or even tiling) you'll have 1024 rays in a tight 32x32 pixel bunch which will all visit similar areas of the scene and data structures. For small bundles it probably doesn't make a lot of difference weather it's 1x4 or 2x2 for example, but you do want to have successive bundles in the same area as much as possible.

back