|
Author Topic:   vol fog
kaber0111
Member
posted January 10, 2000 08:08 PM            
hello.
Well see in my engine (i am using OpenGL) I am trying to get the effect of vollumetric fog. Like where it looks like to fog takes up 3d space. I am sure you know what it is.
Well my question is whenever i enable my fog in never appears to have a volume. I mean the textures appear to have fog but "the stuff in between" stays black.
thanks.

IP:

LDA Seumas
unregistered
posted January 12, 2000 01:33 PM           
Real volumetric fog is an effect that you need to code yourself; neither OpenGL nor Direct3D can do volumetric fog internally.

The basic idea is to make a second "fog pass" over every triangle in your scene, and render fog in the second pass at a density based on the amount of fog between the camera and the vertex being rendered. You will need some way to represent your fog volume, which could be as simple as a height value for the top of the fog if you wanted it to sit over everything at a certain altitude (like water), or it could be a list of fog spheres which would be points with radii, or it could be a 3D array of fog density values, or just about anything else. Then when rendering each vertex in the fog pass, evaluate how much fog the line between the camera and the vertex passes through (this calculation will be different depending on your fog data structures), and set the alpha value for the fog pass vertex based on the amount of fog passed through. Thus if there is no fog between the camera and the vertex, the fog pass will do nothing, and if there is a lot of fog, the fog pass may color the vertex mostly or all fogged.

If you're only doing single-pass rendering normally, you could do the fog pass using Multi-Texture, using texture coordinates on the second texture unit with a gradiated texture (from transparent/no fog on one side to opaque on the other) to control the fogging amount.

------------------
-- Seumas McNally, Lead Programmer, Longbow Digital Arts

IP:

kaber0111
Member
posted January 13, 2000 08:00 PM            
thanks a lot for the reply. I have been working on a algorithm to encorparate vol fog into my engine. It is looking pretty desecnt right now.
thanks.
akbar A.

IP: