Skip to main content
GameDev.net gamedev.net
🔒 Locked

Quake 3 Volumetric Fog

Started by AntonyE Dec 8, 2004 at 4:01 AM 2 replies 3.5k views
Original Post
AntonyE
AntonyE
Does anyone know how quake 3 volumetric fogging works. If a fog shader is applied to a surface, you need to calculate the distance through the fog of the surface behind it. As the distance and even the surface behind the fog plane will depend on the viewer, this has to be done every time. As far as I can see this isn't done by using the stencil buffer or any other OpenGL function. And that is where I am stuck. Any help greatly appreciated!
Ilici
Ilici
I think you can just set the fog coordinates manually for the world, but for the player you should have a plane that defines fog start and one that defines fog end. Then use these to get the fog coordinates for the model which you setup manually.
AntonyE
AntonyE

Yeh, and that is one way that quake does it. But you can actually set fog on a brush, meaning that the plane can't be treated as infinite (so you can kinda see over it). So you could deal with it in a similar manner and work out if a vertex is inside the fog plane or outside and then work out if a line from the viewer to the vertex intersects the surface, but I think that is huge overkill given the amount of surfaces you would have to check.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.