depth buffer and texture mapping-based volume rendering

Hello,

As per the subject, I am rendering volumes using 3D textures.

What I want to do is draw something only if there is an underlying volume. As I rotate the volume, the geometry should only be drawn based on whether it is occluding the underlying volume. If it is occluding an underlying volume, draw it else dont draw anything.

I was suggested the use of a depth buffer, but the depth buffer can only give me the depth of the proxy geometry (which is textured by the volume slices).

Please let me know if anyone has any ideas.
Thanks,
Alark

I think using depth buffer is a good way to solve it.You may try some other depth comparision function.

Thanks for the reply. The problem is that the depth buffer will only give me information about the proxy geometry which is textured with volume slices. The information about the volume itself is not available.

Regards,
Alark

if you use the alpha test to discard parts of the proxy geometry and thus only draw the opaque portions of the volumes you will get the border between the volume and the surrounding into the depth buffer.
also using a fragment program that does the fragment discarding and depth writing like you want it could be a good idea…

Thanks. For some reason, depth buffering seems to work except that the geometry that I am drawing completely loses its color and gets the color of the background. I want it to be drawn in black on the volume. I am guessing this is because of the blending that happens during volume rendering.

Any suggestions?
Regards,

Alark

Trying to use color mask may be some of assistance.

Is that “proxy geometry” actually something like the slices one commonly thinks of when rendering volumes through 3D-Textures?

Then what is the problem with just drawing those slices back to front with the “opaqueness” being in the alpha channel…

Please ignore my post if I’m not getting it…
Greetings.

Originally posted by alark:
[b]Hello,

As per the subject, I am rendering volumes using 3D textures.

What I want to do is draw something only if there is an underlying volume. As I rotate the volume, the geometry should only be drawn based on whether it is occluding the underlying volume. If it is occluding an underlying volume, draw it else dont draw anything.
[/b]
If I understand you right you need depth and stencil. The depth to hide the geometry that is behind the volume, the stencil to hide the geometry that is outside the volume (i.e. not occlusing it).

You have to clear stencil to 0 before drawing anything, set to it e.g. 1 when drawing the volume slices, and draw the geometry with a test that only draws when stencil is 1.

Hope it helps

Dirk