Search code examples
openglgraphicsglslvolume

Opacity correction in Raycasting Volume Rendering


I want to implement high-quality raycasting volume rendering using OpenGL、GLSL and C++. And I use image-order volume rendering. During a step of raycasting volume rendering called compositing, I use the following formula (front-back-order):

enter image description here

When I read the book 《Real-time volume graphics》 page 16,I see that we need to do Opacity Correction if sample rate changes:

enter image description here

And use this opacity value to replace the old opacity value.In this formula,enter image description here is the new sample distance,and the △x is the old sample distance.

My question is : How do I determine △x in my program?


Solution

  • Say your original volume had a resolution of V=(512, 256, 127) then when casting a ray in the direction of (rx, ry, rz), the sample distance is 1/|r·V|. However say in your raycaster you're largely oversampling, say you sample the volume at 3× the sample distance V'=(1526, 768, 384), the oversampled sample distance is 1/|r·V'|, and hence the ratio of sampling rates is 1/3. This is the exponent to add.

    Note that the exponent is only noticeable with low density volumes, i.e. in the case of medical images low contrast soft tissue. If you're imaging bones or dense tissue then it makes almost no difference (BTDT).