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.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

I guess you can precompute a "depth map" for the each skybox face and use that in your fog computations. You will need 2 passes and a custom post processing fog shader though.

It is a neat idea though, I may try it since you will be able to change the colour based on time of day etc and it will sort of bring your skybox to life.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
WishFish
Posts: 8
Joined: Thu Feb 07, 2008 10:08 am

Post by WishFish »

I am also working on a space game.
I have a stars skybox and a grid made of lines which should fade into the skybox in the distance.
I solved it by setting MaterialType to EMT_TRANSPARENT_ADD_COLOR.

SMaterial m;
m.Lighting = false;
m.FogEnable = true;
m.MaterialType = EMT_TRANSPARENT_ADD_COLOR;
driver->setMaterial(m);

Image

I am using this with draw3dline but there should be a way to do that with objects also.

Hope it works for you!
Scarabol
Posts: 167
Joined: Sat Jan 03, 2009 5:26 pm
Location: Aachen, Germany

Post by Scarabol »

Hi WishFish,

could you tell me more about?

Seems not to work in my case :-(

I have a Mesh with your material flags and emissive color (128,0,0,0), nethertheless the mesh appears white as the fog (128,255,255,255) theres no transprency with this objekt, pls help...

Greetings
Scarabol
Scarabol
Posts: 167
Joined: Sat Jan 03, 2009 5:26 pm
Location: Aachen, Germany

Post by Scarabol »

Does anybody has done this, too
Or could explain me how to do?

Greetings
Scarabol
Scarabol
Posts: 167
Joined: Sat Jan 03, 2009 5:26 pm
Location: Aachen, Germany

Post by Scarabol »

OMG! I GOT IT!

Image

I set Fog Color to:

Code: Select all

SColor(0,0,0,0)
and the following to the node:

Code: Select all

planettemp.node->setMaterialFlag(EMF_FOG_ENABLE, true);
planettemp.node->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
planettemp.node->setMaterialFlag(EMF_LIGHTING, false);
There is just one mistake left, as you can't see the earth ist always translucent not only if fog reaches the earth. But i will try to fix it soon...

MFG
Scarabol
Post Reply