PDA

View Full Version : Transparency problems


foxa
21st May 2004, 11:25 AM
Hi Andy -

I have noticed that when I use a transparent material on a surface and place objects behind it you cannot see the object through the tranparent surface, unless you delete one of the transparent surface(s) and then undo. After that it's fine. This must be done for each object placed behind the transparent surface. Is this a bug or my display driver????

Art

Thaellin
21st May 2004, 12:51 PM
This is actually more 'by design' than anything else. In order to render transparent surfaces properly in real-time you have to:
1. Save all transparent surfaces in a rendering frame for last.
2. Sort all transparent surfaces in strict depth order with repsect to the camera.
3. Render the sorted list in back-to-front order. I was going to say disable depth-writes, but if you have a true ordering here that should not be required.

You can also use some interesting tricks to approximate the process, but that's most of it up there.

The main problem is that the transparent surfaces involved cannot intersect if you are to maintain the strict depth ordering. That would require collision-checking each transparent poly against the others and splitting it prior to rendering if required.

There are order-independant transparency methods, but they aren't great for general hardware.

Can it be done? Yes. It's not a trivial thing to back into an existing code-base, though. I'd like to see it work 'properly' but I think there are more interesting things I'd like to see first :)

It's not your drivers, though. It's the program.
-- Jeff

Oh, and I just read Razer's 'transparent TGA' post - which makes life even more difficult for proper transparency, since you'd have to either scan the image for alpha values and queue it up for transparency processing, or you have to strict-order the whole set of geometry in a scene, which defeats the purpose of some nice hardware features.

nVidia has a nice paper on 'depth peeling' which is an order-independant transparency process.. but it requires multiple passes and depth-texture hardware. Bother.

foxa
21st May 2004, 02:15 PM
Thanks Jeff-

It's not really a barn burner (as long as you know how to get arond it), if that's the worst thing to happen this week I'm alright with it.

Art