Jump to content
  • Advertisement
Sign in to follow this  
MARS_999

Fog question

This topic is 4324 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
"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..

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!