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?
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.
ok I’ll check that out! I haven’t read that one. Is it something they will have at barnes and noble?