XiaJun
XiaJun

Reputation: 1915

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?

Upvotes: 3

Views: 2022

Answers (2)

mclarceny
mclarceny

Reputation: 13

datenwolf is correct, but there is one piece of missing information. A transfer function is a mapping between scalar values and colors. In RGBA, the range of values is between 0 and 1. You, as the implementer, get to choose what the actual value of opacity translates to, and that is where the original sample distance comes in.

Say you have the unit cube, and you choose 2 samples that translates to a sample distance of 0.5, if you trace a ray in a direction orthogonal to a face. If the alpha value is 0.1 everywhere in the volume, the resulting alpha is 0.1 + 0.1 * (1.0 -0.1) = 0.19. If you chose 3 samples, then the resulting alpha is one more composite from the previous choice: 0.19 + 0.1 * (1-0.19) = 0.271. Thus, your choice of the original sample distance influences the outcome. Chose wisely.

Upvotes: 0

datenwolf
datenwolf

Reputation: 162184

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).

Upvotes: 4

Related Questions