Part 8: Volume Rendering

Performance Template

Required Image

Here is the required image:

Image #8A

One thing that I tried at one point was computing the normal using the opactity. I actually found that this made a large difference in the interior region of the skull:

Image #8B

Extra Credit

I chose to implement a hypertexture material.

Image #8C

The function is this case is just a basic Perlin noise, minus the distance squared.

Design Choices

I implemented the volume rendering code as a surface shader, exactly as described in class. Though I thought for a long time about implementing it as a proper volume shader, I decided against this based on time constraints. I rework things later if I ever get a chance.

The biggest difference is that I shoot the "exit" ray before raymarching, though the shading is still defered till the end. This way, if a solid object interpenetrates the volume, it will terminate the ray march appropriately early. In either case, shading is still deferred till the end, and the cumulative opacity is folded into the attenuation cutoff for shading the exit ray. Basically, I chose to do all of the small, easy optimizations mentioned in the slides.

One change that I did have to make was that I precomputed the flip of the data in X and Z offline. My bounding box code gets cranky if the minimum and maximum corners violate the preconditions that they are indeed the minimum and maximum corners. I also merged the header info into the volume data file in the manner of PPM files and heightfields.

The hypertexture is pretty much just a cut and paste version from the volume function. I added a factored out the code to evaluate the density into its own function, and then replaced the trilinear interpolation with an evaluation of that. For calculating the normal, it computes the gradient on the opacity by evaluating the function at a slight offset in X, Y, Z and finding the difference in the opacities.


Last modified: Wed Mar 30 00:23:00 Mountain Standard Time 2005