Adaptive Mesh Refinement in Houdini
After much trial and error (so much error), we've gotten even AMR data to work with ytini!
Before and After
The video on the left is an early attempt of rendering AMR data in Houdini. You can clearly see the AMR bounding boxes in the data.
The video on the right is the same dataset, looking smooth and beautiful.
So What's the Secret?
The solution is twofold:
First, this requires not only writing out the data variable itself, but also a mask variable, which defines where one level "cuts" a hole in the level around it. In order for this to work, each AMR level is written out as a separate .vdb file.
Then, you need to read the mask field in the shader, to determine which vdb you wills be rendering at any given sampling point. An important thing to note is that Mantra/Houdini automatically interpolates volumes to create a smooth falloff at the edges. In this case, we do not want that interpolation; we want a clean cut so that the AMR boxes fit nicely within each other. So, in the shader, you must look up the mask value by index rather than by position. This ensures that edges and corners do not fall off to zero, but remain constant through the entire voxel.
A ytini tutorial on how to visualize AMR is available Right here right now!