Jump to content

  • Log In with Google      Sign In   
  • Create Account

Fog-fields in OpenGL


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 PGmeiner   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 September 2001 - 09:09 PM

How can I define Fog in OpenGL only at a special place. With GL_FOG_START and GL_FOG_END i can only define the distance of the current user but how can i define just a small part of my world with fog?? For example when I want to simulate haze in the lower level of my world. thanks Peter Gmeiner

Sponsor:

#2 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 30 September 2001 - 10:24 PM

opengl doesn''t support volume fogging only linear fog model.
cause opengl is designed to be efficient and there is no *really*
common efficient way to do volume stuffs.

but back to your question: you can create volume fogs with yourself and with opengl, but not using single API call to do that.

#3 PGmeiner   Members   -  Reputation: 122

Like
Likes
Like

Posted 30 September 2001 - 10:53 PM

Do you know some techniques or documents where volume fogging techniques are detailed described?


Peter Gmeiner

#4 MButchers   Members   -  Reputation: 123

Like
Likes
Like

Posted 01 October 2001 - 02:57 AM

Hi there,

there is always the EXT_fog_coord extension, look here

http://www.ati.com/na/pages/resource_centre/dev_rel/sdk/RadeonSDK/Html/Info/Extensions/EXT_fog_coord.html

else you could either use several alpha blended polygons placed
one over the other or use a particle system.

Hope it helps

Mark.





#5 Scarab0   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 October 2001 - 03:24 AM

Peter, volume fog can be as easy or complex as you want. It all depends on what your volume looks like. One easy volume would be for example if you have a single infinite plane just above the ground and you want fog to be below that plane. In essence, creating a layer of fog over the ground.

What you then do, is for each vertex you trace a line from the camera to the vertex and check whether it crosses the fog plane. If it does, you need to know how much distance it travelled through the fog. That is, the distance from the vertex to the point of intersection with the plane.

If we call this distance the FogValue, then the final color of the vertex will be:
FinalColor = OldColor * (1-FogValue) + FogColor * FogValue
(Note though that you can't directly use the calculated distance as the fogvalue, you need to scale it a bit, otherwise you have too little/too much fog.)

Another relatively easy fog volume would be a sphere (http://www.gamedev.net/reference/articles/article672.asp) or an axis-aligned bounding box. But as said, you can make things as easy or hard as you like. You could even have a full polygonal mesh as a fog volume.

Hope that helped a bit,

Dirk Gerrits

Edited by - Scarab0 on October 1, 2001 10:25:09 AM




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS