View Full Version : Fog Effect
07-15-2003, 04:31 PM
Rambling in the scene , i need fog effect .
Is it possible such as some blocks of scene with fogging and some without fogging?
07-16-2003, 12:10 AM
Built-in OpenGL fog is just for distance attenuation.
If you want something more sophisticated, you can :
1/ have a look at EXT_fog_coord extension (spec here : http://oss.sgi.com/projects/ogl-sample/registry/EXT/fog_coord.txt)
2/ use vertex/fragment programs
3/ do it yourself in software (vertex-based fog of course)
07-16-2003, 03:28 AM
you can turn on/off fogging (for particular objects) by using the glEnable and glDisable functions - but the effect depends on your scene.
so you can say which object will be blended by the fog and which are not...
07-16-2003, 03:59 AM
to kehziah:your URL doesn't exist.Can you give me some particular explain for your solution?
what is vertex/fragment meaning?
How can i do vertex-based fog?
07-16-2003, 04:19 AM
The link is screwed by the closing parenthesis. Here it is again :
This extension is probably what you are looking for. It allows you to specify a fog coordinate per vertex. This coordinate is used in fog calculation (instead of the standard fragment depth approach).
You could do something similar in software, if the extension is not supported : for each vertex, determine its fog coord, perform the fog contribution calculation, and use the result as the color for the vertex. Pretty much in the same way as you would do to perform lighting in software.
Vertex and fragment programs (aka vertex and fragment(or pixel) shaders) are custom pieces of code written in a certain language that are executed by the graphics chip. They replace the old fixed function pipeline.
07-16-2003, 04:48 AM
kehziah,thank you very much
i think you give the best message for my purpose.
i am a new one for using opengl.
Forgive my ignorance.
i don't know how can i use EXT_fog_coord (it looks like GL***)and where i can get the version of FogCoord[fd]EXT .And how can i get the help message for these functions?
thanks your help again
07-16-2003, 06:22 AM
To use an extension :
you must have a valid header containing the enumerants. This is required for your code to compile. Then, at runtime, you must check the extension string (glGetString(GL_EXTENSION)) to see if the extension you want to use is supported. If it is, you must load the function pointers from the driver. Then you can use the extension as described in the spec.
Now all this can seem cumbersome. But there is a very nice library that will make it easier : http://www.levp.de . Look for Extension Loading library (on the left). There is good documentation about the extension mechanism.
About man pages... Well, there are no man pages. You have :
1/ the extension specification (the link I gave you)
2/ various demos on vendors websites that demonstrate the use of some extensions. What I found on ATI's website regarding fog coord :
07-16-2003, 04:40 PM
You are very kind.
Thank you very much.
Let me try!
Maybe I will ask you some question during my using EXT_fog_coord.
Thanks a lot!
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.