Real-time OpenVDB ray-marching libraries available

1,138 views
Skip to first unread message

Matthew Reid

unread,
Feb 18, 2014, 6:15:38 AM2/18/14
to openvd...@googlegroups.com
Hi all,

I've open sourced some libraries for real-time OpenGL preview of OpenVDB grids using voxel ray-marching. I've only tested on Windows, but everything should be cross-platform. License is MIT.

https://github.com/matthew-reid/Graphtane

There's a video here:
http://vimeo.com/mreid/graphtane

The basic approach is:
- flatten VDB grid into 2 levels; deepest internal node level and leaf level
- pack leaf node data into texture atlases
- build indirection map of leaf index -> texture atlas coordinates
- create renderable box volume for each internal node
- if transparent sorting is disabled, batch boxes into fewer draw calls
- if transparent sorting is enabled, sort boxes
- render boxes with ray-marching shader

Current limitations:
- Flattening the grid to 2 levels may result in a large number of draw calls for extremely large grids. This could be overcome by supporting more levels of node indirection.
- Shader does not support adaptive sampling. I think this would improve performance, but it's not critical because most of the empty space in the grid is already 'culled' by virtue of only rendering the deepest internal nodes. If more levels are supported in the future, adaptive sampling may become necessary.
- The limitation of max hardware texture size can lead to many atlases being required. Due to lack of hardware support for 3D texture arrays, this may result in many draw calls. One could potentially get around this by using TBOs or 2D texture arrays and implementing manual trilinear filtering.
- The flattening step does not take tiles into account, so tile nodes will not be rendered unless they are first voxelized with openvdb::tree::Tree::voxelizeActiveTiles()

Please let me know if you find this useful, or if you have any questions or feedback about my approach.

Ken Museth

unread,
Feb 25, 2014, 1:38:11 PM2/25/14
to openvd...@googlegroups.com
Very cool Matthew! From the video it looks like you're missing the tiles (upper-level VDB nodes with constant values). From your description this sounds like a known issue. It should be relatively easy to detect and include them when you flatten the VDB tree into your 2 level structure in texture memory. Let me know if you need some help with this.

-K
Reply all
Reply to author
Forward
0 new messages