From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

OpenVDB Volume Rendering

This project aims at integrating OpenVDB in Cycles.

First results

Dev-cycles-openvdb-render-explosion.png Dev-cycles-openvdb-render-smoke1.png

Grids

Grids are currently loaded from files, just like image textures. No assumptions is made on the number of grids present in a given file, or their names, so that any scalar or vector grid (actually "FloatGrid" and "Vec3SGrid") contained in the file will be accessible in the shading context. This also makes it possible to render files exported from other software, though in this case there will most likely be a mismatch between the other software's and Blender's unit system.

Here is an example file setup to render fire.vdb available at the OpenVDB website: File:Cycles openvdb fire.blend. Note: fire.vdb needs to be downloaded separately.

Sampling

Sampling is done by means of grid samplers (openvdb::tools::GridSampler) making of value accessors (openvdb::tree::ValueAccessor) for accelerated (cached) tree traversal.

The following samplers are implemented:

  • point: performs nearest neighbor interpolation, fast
  • box: performs trilinear interpolation, slower but prettier

Ray intersections

If the grid's voxels are uniform, ray intersection and volume marching is performed with OpenVDB's built-in ray intersectors. By making use of a custom hierarchical digital differential analyzer, they help skipping empty space by leap frogging inactive tiles and values. Its hierarchical nature makes it so that leap frogging happens at any level of the tree (from upper nodes down to individual voxels).

Shortcomings

  • Compilation with OSL is not supported.

ToDos

  • file sequences are not updated during viewport rendering.
  • support for ray marching multiple volumes.
  • decoupled ray marching support