Faded Terrain Distance?

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.
Post Reply
alogon
Posts: 8
Joined: Sat Oct 07, 2006 2:51 am

Faded Terrain Distance?

Post by alogon »

I am using setFarValue() to set how far my user can see but it looks like the terrain just ends at that distance and the sky starts. I am wanting an effect like world of warcraft has where there is a fog or blur that starts at a certain distance to fade out the terrain. Where if setFarValue() is high then you have a view like this....
Image
however when setFarValue() is low then you get a blured effect like this...
Image
instead of this hard edge
Image
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Try using the fog then ;)

I believe the per pixel lighting tutorial uses fog, very lightly in it so that will show you how to set it up.

Basically i think all you need to do is to firstly set up the fog with driver->setfog() and then for each scene node you want affected by the fog you set the material flag for fog to true on that node.
Image Image Image
alogon
Posts: 8
Joined: Sat Oct 07, 2006 2:51 am

Post by alogon »

Thank you for the setFog() tip it worked just as i was wanting.

Code: Select all

//setup the fog
   driver->setFog(video::SColor(0,138,125,81), true, 1000, 10000, 0, true);
//apply the fog to terrain
   terrain->setMaterialFlag(video::EMF_FOG_ENABLE, true);
Image
I went a little overboard with the amount of fog in this screenshot now i just have to make the bottom parts of my skybox match the fog. Thanks again for the quick response.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Yeah that's the only problem with this fog is that it only affects scene nodes, not the skybox or open space, so if you had a gap in your terrain you could just see straight through it and there would be no fog there, but if you are surrounded by terrain all the time then it should look fine!
Image Image Image
Post Reply