I am doing a research project on the project optixParticleVolumes from CHAPTER 29
Efficient Particle Volume Splatting in a Ray Tracer fro mteh book ray tracing gems.
I am trying to understand how the algorithm works and wanted to see in someone here could say if I understand it correctly:
They have a ray generation program that splits each ray into equal sized slabs. Each slab then looks for particle intersections in its slab.
They find an intersection sample by looking at the length to the particle center from the ray shooting origin which should be from the camera. Then it checks if the ray from the origin to this length is inside the particle radius, then they take that sample as an intersection. I guess we could say they project the center of the particle onto the ray.
What I do not follow is where does the BVH traversal happen? Is it inside each slab or before?
If they split each ray into several slabs,then it looks like they call rtTrace for each slab, would that not give a much higher ray cast count because we need to shoot one ray with rtTrace from each pixel several times?
The bvh traversal happens within each call to rtTrace. Basically, the entry and exit points of the entire volume are calculated, then that interval (tenter, texit) is divided into N slabs. Each slab is traversed separately, in order. so first it rtTrace is called with an interval (tenter, tslab_boundary_0), results of that slab are processed, then we repeat for interval (tslab_boundary_0, tslab_boundary_1). repeat until we process all slabs.
When you say the entire volume you mean the volume of the entire data set, the entry and exit points of the entire data set we are using?
Then we are dividing that volume into N slabs and each slab is traversed using BVH acceleration structure inside the rtTrace call?
But does that mean that we are shooting several rays for the same pixel? rtTrace is run for several intervals but along the same ray? Why not let the ray pass from the entry to the exit and process all data in one go?
Yes, the entire volume data set. You might have multiple volume data sets in a scene.
Yes, you are traversing multiple rays, but the rays have clipped intervals so portions of the data set outside of the slab are efficiently culled (yay BVHs). Slab spacing is a function of the particle-buffer-size and particle radius. If you set this buffer large enough, you will indeed traverse the entire volume in one go. however, this will require a large buffer-size and will have high memory overhead and suboptimal perf.
You are mostly correct above. You are calling trace on same ray-origin and ray-direction but, as you note, the interval is different. A ray is really made up of all of these components (plus ray flags).
Typically an optix launch is given launch dimensions which correspond to pixels. For instance, if your image is 1024x768 then you would invoke your launch as a 2D launch with 1024x768 grid. Then each launch index corresponds to a pixel. Take a look at our SDKs pinhole_camera to see this in action.
Coherence can mean a couple of things. In the paper we are talking about executional coherence, meaning different rays (and therefore threads) are executing the same code together as well as data coherence – different threads accessing the same data.
Yes, there is potential for gain in coherent memory access, but often in ray-tracing algorithms (especially in path-tracing-like workloads, but here too) the biggest gains are in executional coherences. This means that ideally all threads in a given warp are executing the same code.
16 was arrived at empirically. The calculationf for slab size takes into account this number and the particle size to try to avoid overflows – but this can happen.
As for dashed lines – I dont have a copy of the article near me at the moment so I am trying to remember … I think that the dotted line shows the projection of the particle cebter onto the ray path. The particles have finite extent.
Great, thank you for your time and response, it really helps!
Do you have any perception of how much thae ray coherence helps in your solution?
I don’t quite understand why overflow could happen. If you say that there are 16 particles per slab, do you mean that overflow could happen if there are more than 16 particles per slab in the actual dataset?