Copy ~banks/release/volume.tar.gz into your vis directory.
Gunzip. Untar. Type "make."
Run "block" and look at the volumetric density in the cube.
Run "splatGrid" and look at the volumetric density. There is a dragger that you can move around. It carries some density with it. Another blob of density stays centered inside the cube.
Volume rendering, like global illumination, does not fit
well with the conventional OpenGL + sceneGraph kind of
graphics interface. You have to integrate the emission and
scattering of light along ray from the eye into the volume,
but OpenGL doesn't trace rays.
The best cheat is to draw semi-transparent polygons whose
opacity gives the illusion of depth. These cheating polygons
are called "splats."
![]() | View the transpMap.65x65.rgb image in the pics directory to see a splat. This image is being texture mapped onto polygons. |
![]() | Note that "block" runs faster (it is 45x45x45) but uses "additive" transparency. This is incorrect transparency. But it runs fast because the scene graph isn't sorted from back to front. It looks fairly smooth because layers of the grid are rendered with no overlap within a layer. |
![]() | By contrast "splatGrid" uses multiplied-alpha, which is more nearly correct. But it requires a lot of code to ensure that the splats are always rendered from back to front (it is only 10x10x10). |
![]() | And in some orientations the splats betray the underlying grid structure rather than presenting a smooth volumetric image. |
Modify block.cxx so that it uses an SoDragPointDragger the way splatGrid does. The dragger carries some density around with it. Note that you must make the volume "unpickable" so that mouse clicks go right through it. See the SoPickStyle in splatGrid.cxx .
Consult the Inventor Mentor chapter on draggers to see how you can modify the appearance of the SoDragPointDragger. Make it less intrusive in the scene. (Change its size or geometry or material properties or something.)