PDA

View Full Version : Shadow y-coordinate, how to set ?



edotorpedo
09-21-2000, 10:55 AM
Hi,

Im trying to create some kind of volumetric fog, and I need to insure that that a pixel with y-coordinate higher than, say 5, isn't fogged. How do you do this ?

Thanks,

Edo

zed
09-21-2000, 12:58 PM
maybe have a look at the glFogCoord(..) extension

DFrey
09-21-2000, 01:11 PM
It sounds like you are wanting to know how to determine which parts of a given polygon should be fogged. And it sounds like your fog is bounded by a plane. If I'm following you correctly then one way to do this is by clipping each polygon with the plane of the fog. If all vertices are below the plane, then the whole polygon is fogged. If all vertices are above the plane, then the polygon is not fogged. If it clips the plane, the the part below is fogged and the part above is not fogged. The hardest part of all this is writing the code that splits a given arbitrary polygon with a given plane. But to do that you just determine where each edge intersects the plane, and then use the new points to form an edge of each new polygon winding such that the edge cancels out.