Two new samples have been posted to github!
1) gDepthMap - This sample shows how to integrate OpenGL rendering and GVDB volumes with proper depth integration. It works by first rendering the scene with OpenGL Framebuffer objects (FBOs) to write out color and depth textures. The depth texture is then copied to a GVDB render buffer and used as input into the volume raycaster. This allows volume rays to properly terminate when they hit the OpenGL depth. Finally, the volume rendering is composited with alpha on top of the OpenGL color render, giving a final poly+volume rendering. Since volume raytracing is independent of polygon rendering, this gives the greatest flexibility in GL rendering quality and composition design for applications that make use of OpenGL.
2) gResample - The resample demo shows how to load a RAW volume from disk into GVDB as sparse data. Loading RAW data is just one way to get volume data into CPU memory. Once in CPU memory, creating sparse data from dense is a two-pass technique. The data is first loaded into a GVDB AUX buffer for transfer to GPU using PrepareAux, SetDataCPU and CommitData. With the source data now on GPU, the first pass is to downsample the data and use the average values to determine which bricks to activate. The function gvdb.DownsampleCPU takes the input data, and evaluates the volume at all potential bricks. Any bricks above a given threshold are activated. If the first pass is disable, it is equivalent to loading the entire dense data. After the topology is defined, the second pass using gvdb.Resample to transfer the source volume into GVDB channel 0 voxels.
Dense data at 128x256x256 from the Visible Human Project (male head), National Library of Medicine, National
Institutes of Health, USA.