Fog at the edge of terrain

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
badday
Posts: 102
Joined: Mon Aug 16, 2010 1:14 pm

Fog at the edge of terrain

Post by badday »

Hi,

is there an easy way to have fog only at the edge of a ITerrainSceneNode? So that you can´t see the the border of it.



Thanks,

badday
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Post by REDDemon »

yes you can use a linear fog in this way.

Code: Select all

near plane = 1
far plane = 1000
linear fog starting limit = 900 (or what you like)
linear fog ending limit = 1000 (or what you like)
that's pretty simple. You can try with exponential fog also. I don't guarantee that this will work.

You should also remember to put as BG color the same color of the fog or at least uses a skydome/box with the lower part of the same color of the fog
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
badday
Posts: 102
Joined: Mon Aug 16, 2010 1:14 pm

Post by badday »

I hope I got u right.

Surely you can make a fog all over the terrain and make the area of the camera movement that little that it works fine. But what I am actually looking for is a fog that is only at the borders of the terrain.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Post by hendu »

I doubt there's fog like that, but you could place a suitable billboard/cube/etc there with a fog texture.
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

Well, just enable/disable fog dependent on the distance of the camera to the terrain borders.
"Whoops..."
badday
Posts: 102
Joined: Mon Aug 16, 2010 1:14 pm

Re: Fog at the edge of terrain

Post by badday »

@randomMesh: Well, ok, you´re right, that will do the trick. Thx.


Another problem I see is that the material type of the terrain is a GLSL shader. So as far as I see it, it won´t be affected by irrlicht´s fog, will it? Of course, I can make fog via shader, but the thing is that this doesn´t lead to the intended effect as only the terrain get´s another colour, but there is no fading effect.

Does anyone know how to accomplish that?
Brkopac
Posts: 88
Joined: Fri Sep 19, 2008 2:36 am

Re: Fog at the edge of terrain

Post by Brkopac »

Image - The glory days.
badday
Posts: 102
Joined: Mon Aug 16, 2010 1:14 pm

Re: Fog at the edge of terrain

Post by badday »

Using that alpha-trick in the terrain shader worked well, thanks :)
Post Reply