ordering primary rays

Practical and theoretical implementation discussion.
Posts: 5
Joined: Thu Sep 05, 2013 1:37 am

ordering primary rays

Postby alidade » Sat Sep 28, 2013 1:36 pm

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?


Posts: 5
Joined: Thu Jan 23, 2014 8:11 pm

Re: ordering primary rays

Postby phkahler » Mon Jan 27, 2014 1:53 am

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.

Return to “General Development”

Who is online

Users browsing this forum: No registered users and 9 guests