Fog question

Started by
14 comments, last by MARS_999 17 years, 6 months ago
I have been trying to add in fog to my game with a single quad thats in a circle and surrounds my view and is place X amount from the view so I can try and hide the popping in and out of my units and terrain. Problem is I don't like how it looks like a wall and not much depth or volume to it. So my question is how does one solve that problem? Do I need to make a few more circle behind each other to add some more depth? And does anyone have a good shader that covers some decent looking fog? Thanks
Advertisement
opengl and d3d have build in fog implementations glFog ....
http://www.8ung.at/basiror/theironcross.html
D3D or OpenGL?

Both have fog done in-hardware, you just turn it off/on and set the near/far zone and the falloff type (linear, exp, exp2)

First hit on google was this
see if that works for d3d

First hit on google for OpenGL was this

HTH
-Michael g.
Yes I know they both do, and how to use them, my question is how to get a more volumetic looking fog so it looks deeper. That's why I was asking do I need to have a few rows of polygons so spread the fog depth over a few row vs. one row of polygons? BTW I am using GLSL so FFP fog doesn't work unless you do it in the shader...
"I have been trying to add in fog to my game with a single quad thats in a circle and surrounds my view and is place X amount from the view so I can try and hide the popping in and out of my units and terrain."

This sounds like a bad method for this.. i reccomend instead that you use a skydome or skybox with a fog-colored horizon.. then just use the fog to fade into that..

As far as fog goes, fog is fog.. there are various formulas to calculate it, but it all looks mostly the same unless you use some kind of pixel fog..

But none of these will help in your case i think. but then you havent described your problem very well anyway..
Quote:Original post by MARS_999
Yes I know they both do, and how to use them, my question is how to get a more volumetic looking fog so it looks deeper. That's why I was asking do I need to have a few rows of polygons so spread the fog depth over a few row vs. one row of polygons? BTW I am using GLSL so FFP fog doesn't work unless you do it in the shader...


There s something called fog coordinate extention for volumetric fog in opengl

see here

http://oss.sgi.com/projects/ogl-sample/registry/EXT/fog_coord.txt
http://www.8ung.at/basiror/theironcross.html
Yeah that is probably what I am looking at using is that extension... What I am trying to do is the horizon where the land and sky or water plane is at I would like to cover that up with this fog but allow it to have some depth to it. So I am thinking about taking my current circle I have with one quad that faces me all the time and is at the point where it meets the water and sky and making them all cubes and using this extension with that to add the depth so I can control the fading and how far away I want it? Not sure if this clears up my issue? Thanks
that probably works, you got a 2d quad parallel to the ground and each vertex has its own fog coordinate value, just make sure you don t overlap the quads this might lead to artifacts


maybe have a look at gametutorials.com they had a tutorial about this a few years ago
http://www.8ung.at/basiror/theironcross.html
Well I think its working but I still don't like the way it looks 100%. I think the problem is the effect has a wall look to it. I am thinking I am going to need to use a particle engine and make some fog with that so it looks less like a wall and more natural? What do you think? Thanks
MARS_999, have you considered doing the fog as post-render fullscreen pass?

If you can capture the z-buffer to a texture, then you can use that in a fragment shader to computer distance fog on a per-pixel basis, as an overlay to the scene.

This topic is closed to new replies.

Advertisement