PDA

View Full Version : depth buffer and texture mapping-based volume rendering



alark
06-03-2005, 06:06 AM
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

Hendric Kid Lee
06-03-2005, 06:36 AM
I think using depth buffer is a good way to solve it.You may try some other depth comparision function.

alark
06-03-2005, 06:51 AM
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

Chuck0
06-03-2005, 06:56 AM
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...

alark
06-03-2005, 10:13 AM
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

Hendric Kid Lee
06-07-2005, 09:36 AM
Trying to use color mask may be some of assistance.

Michael Steinberg
06-07-2005, 07:15 PM
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.

Dirk
06-08-2005, 07:51 AM
Originally posted by alark:
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.
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