PDA

View Full Version : trasparency and shadow volumes



Nick's a Novice
12-08-2005, 06:36 AM
I've got a model that is casting shadow volumes on both land and sea. It works for the land, but not for the sea... I think the reason for this has something to do with the fact that the sea is made partially-transparent by using glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); When I'm doing the shadow volumes I have to blend using (GL_ONE, GL_ONE). Any thoughts on how to cast the shadows onto the water, but still preserve transparency?

dorbie
12-10-2005, 01:40 AM
Depends how you do the lighting pass. The basic problem is you only have a single z value for the sea when you actually have two depths and two volume intersections, the visible surface under the water and the surface of the water itself.

You have a dilema, you could split the underwater portion off into a separate pass from the surface, that way you can iluminate them using volumes independently and blend the results accordingly, but the devil is in the details.

If you look at my chapter on how to render water in Dave Astle's book "More OpenGL Programming" I explain that water is a combination of two factors. The underwater refracted term and the above water reflected term. Using this information you may conclude that you shadow the underwater term and use the Fresnel coefficients to blend that shadowed term with a reflected environmental term that is unshadowed for some compelling results. The environmental rendering may include shadows of course, but the surface of the water is not part of the shadow algorithm because there is no direct interaction visible of the shadow and the water surface.

Nick's a Novice
12-12-2005, 05:52 AM
ok I'll check that out! I haven't read that one. Is it something they will have at barnes and noble?