fading fog into a skybox

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

fading fog into a skybox

Post by 3DModelerMan »

Hi I was wondering if there is a way to make the fog fade into my skybox instead of a set color.
Thanks :D .
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

how would it look like?
sorry cant image
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

ummm

Post by 3DModelerMan »

Like the way mountains fade into the atmosphere.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

since a skybox is always WAYYYYYYYYY far away........ then if fog were applied to the skybox the fog would always block the skybox because the skybox is so damn far away that it is past the end point of the fog. I know, it isnt really that far, but the way it is drawn it is supposed to be. Anyhow, mountains are 3d and you can calculate a fog value based upon the depth of it from the camera. The skybox is just a 2d image pasted across a polygon. No depth.

You could fake it by creating a 'foggy' looking skybox image.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

ummm

Post by 3DModelerMan »

Well, what I mean is the alpha value of the fog.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

but the skybox is still so far away that the fog will definately have reached it's far limit, and since anything after the far limit is total fog..... the whole skybox will be nothing but fog. see what I mean? if you want to have a skybox affected by fog, I guess you could create 'walls' around your world and then put the skybox textures on them. Then if you applied fog to these 'walls' it would attempt to do it right, but the walls are just rectangles so either the whole thing is foggoed or not i think.....
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

something like this?
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

I like what you are showing, but I am actually inteested in the original posting as i would love to see how they get around it. If they can pull it off, I will certainly use the code :)
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

well, i dunno just saw before xD
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

no

Post by 3DModelerMan »

I don't want the skybox to be affected by the fog, no matter how far the far value is, the skybox will still not be shown anyway. I mean how do I fade my terrain objects alpha channel with the fog, so the skybox shows through gradually.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

That's got nothing to do with the skybox then, you just want to fade out the objects based on their distance from the camera.

That's basically what the fog does but it overlays a fog colour on the node according to its distance from the camera.

So i guess you could change the node's material's diffuse colour (or one of the other colours) so that it's faded out and give the node a transparency material, vertex alpha i should think. I'm not sure if it will work though as i've always had trouble with changing diffuse colours on nodes...
Image Image Image
Frank Dodd
Posts: 208
Joined: Sun Apr 02, 2006 9:20 pm

Post by Frank Dodd »

I appreciate the effect your trying to create, although I don't think alpha would be the way do go with this making the terrain gradually transparent as the distance from the camera increases would create some very odd effects.

In the demonstration scenes I have created I simply balance the fog color against the average color of the skybox. Probably painting a heavily fogged band at the horizon of your skybox texture against which your fogged terrain would be silhouetted would help also.
squisher
Competition winner
Posts: 91
Joined: Sat May 17, 2008 2:23 am
Contact:

Post by squisher »

Frank Dodd wrote:I simply balance the fog color against the average color of the skybox. Probably painting a heavily fogged band at the horizon of your skybox texture against which your fogged terrain would be silhouetted would help also.
This is fine and dandy as long as you *have* a terrain.. The game I'm writing is based in space, and as such I'm having a very difficult time trying to get things in the distance fade out nicely without looking wacky. How do the commercial space shooter games do it?...
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

If I remember correctly, space games don't use skyboxes. They use something like planes or convex shapes that have textures with alpha value in them.

Fading would mean using a post process in the pixel shader code, tho. Or perhaps a change in texture.
Image
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

ummm

Post by 3DModelerMan »

Okay I'll base it on an average of the skybox color. I guess for the space shooter you could change the vertex alpha as they get farther from the camera?.
Thanks :D .
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
Post Reply