Understanding Ray marching in OpenVDB.

738 views
Skip to first unread message

Tom

unread,
Jan 19, 2017, 5:41:32 PM1/19/17
to OpenVDB Forum

Hello everyone,
         I am learning the ray marching concept in OpenVDB. I find that the times of intersection with surface is limited to the leaf level and does not extend to the voxel level. However, the Levelset intersections and normal ray intersections are calculated at the voxel level. Could someone please explain the significance of this ray marching implementation.

Ken Museth

unread,
Jan 29, 2017, 11:12:17 PM1/29/17
to OpenVDB Forum
Hi Tom,

I'm not sure I understand your question, so despite actually having written the code you're referring to I'm not sure I can give a meaningful answer. It's possible you're comparing two different types of ray-intersection algorithms, both based on the same Hierarchical Digital Differential Analyzer (HDDA). There's a level set ray intersector, which produces a hit at the voxel level of the tree structure (because it's a ray-implicit-surface intersection problem) and another volume intersector that generates (possibly multiple) intervals of intersections against the active values. By design level sets never have active tiles, which implies the intersection tests are always resolved the the voxel level. However, (FOG) volumes might have active tiles which means intersections can be produced at any level of the tree structure. Since volume rendering involves ray integration, the volume intersection algorithm plays a very different role than the level set intersection algorithm - it is used to accelerate the ray integration by skipping empty (background) space. This means we don't HAVE to resolve the ray marching at the voxel level (thought we could), since any leap-frogging over empty space accelerates the ray integration. Since the DDA at the voxel level is costly (it only advances the ray one voxel per update) it's much less efficient (per distance along the ray) than the DDA at the upper node levels. Long sort short, for performance reasons, I stop the HDDA for the Volume intsector at the leaf node level, which in turn leads to a good balance between a fast HDDA and efficient empty-space skipping. Hope this makes sense and that I actually addressed your question :)

-Ken

b...@formlabs.com

unread,
Apr 6, 2021, 8:35:51 AM4/6/21
to OpenVDB Forum
I think what Tom is asking is how to use HDDA to cast rays through voxels. AFAICT, DDA lets you step along individual voxels, but the HDDA classes (LevelSetHDDA and VolumeHDDA) both have similar but different APIs to the DDA class (I have trouble following those docs). There's the  LevelSetRayIntersector and  VolumeRayIntersector classes which may do what Tom wants?

What I can't figure out from the docs is how to cast a finite-length ray through a sparse volume and have it tell me at each step if it's gotten to the end of the ray and how many voxels it skipped. It looks like LevelSetRayIntersector may do this with its  intersectsIS member function? (TestLevelSetRayIntersector.cc shows example usage, although I don't see it showing misses: either misses that graze an active leaf and then miss or misses due to a finite-length ray.

Is LevelSetRayIntersector the right thing for looking for occupied voxels along rays? Can it short-circuit if I want to search a finite distance or do I have to let it keep going until it finds something?

Thanks,
Ben
Reply all
Reply to author
Forward
0 new messages