Fog implemented into the 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.
Post Reply
Mochino
Posts: 12
Joined: Sat Jun 11, 2005 5:21 am

Fog implemented into the Skybox?

Post by Mochino »

Hello, i've been working for around 2 weeks with the engine, but i have a question, if i have a terrain when it turns into fog from a distance just the terrain turn into fog (which is great because you have to implement fog to every element on the game) But how can i implemente the fog so it looks more real, example in a room you apply it to every wall or element in the room and it looks great (example quake 3 map)

But can i implement fog into the skybox so it gives the effect of fog into all the level?
thank you for your replies.
don_Pedro
Posts: 84
Joined: Fri Jun 10, 2005 1:34 pm
Location: Poland
Contact:

Post by don_Pedro »

You have to make some changes in engine and recompile it. In CSkyBoxSceneNode.cpp, CSkyBoxSceneNode::CSkyBoxSceneNode(...) you have to add for all materials line

Code: Select all

Material[?].FogEnable = true;
This probably should be enough, but I dont't think it makes much sense since skybox is always sticked to the camera position.
Mochino
Posts: 12
Joined: Sat Jun 11, 2005 5:21 am

Post by Mochino »

Thank you, what i want to get is the effect of fog all around the level.

I see your point, but imagine i'm creating this huge outdoor lever without any walls on it. just terrain, sea etc. How can i creat fog all around the level?
Maybe stick a model with 100% alpha, to the camera so far and so huge it will create de effect?
don_Pedro
Posts: 84
Joined: Fri Jun 10, 2005 1:34 pm
Location: Poland
Contact:

Post by don_Pedro »

If I understand you correctly, I see 2 possibilities depending of what you need.
1) if colour of fog is stable arround a game, it doesn't ever changes, all you need are correctly prepared textures for skybox, just make textures of sidewalls fading into fog colour from top to bottom. Here's example from my old test:
Image
2) if you want colour of fog to be dynamic, it's little harder, you have to make textures as usual, but apply material type EMT_TRANSPARENT_VERTEX_ALPHA to side walls of skybox and make colour of bottom vertexes of the walls with alpha 0. Colour of background should be colour of fog. It should look ok, I think.
Guest

Post by Guest »

Hmmm. I remember just setting a material flag on the map scenenode did the trick - then again, I'm two releases behind on Irrlicht, so it may no longer work that way.

Something like:

Code: Select all

 mapscenenode->setMaterialFlag( EMF_FOG_ENABLE , true);
Guest

Post by Guest »

- or maybe I just don't understand the question -

If you've got a problem with the skytextures being fullbright, maybe you can use the materialflag trick with the skybox scenenode, but I have no idea about what the scale of the skybox is, so I don't know how large the fog distance would have to be.
Mochino
Posts: 12
Joined: Sat Jun 11, 2005 5:21 am

Post by Mochino »

Well, i don't have a map to use the fog into, but i will try something to be able to fog all the outdoor in the level.

Thank you guys.
Guest

Post by Guest »

Ive had this same problem..
Create a simple four wall structure with your modeling software and place it and size it a bit past half way up and span your entire viewing area.. add the fog to it and set it up..
Then just add a full transparent tga to it..
Latter on if you plan to make the level build as you move you could attach the object to follow the cam.. But like others said then your fog dosnt seem as real because its moving with you...

I plan to create simulators (Sims) sections of land and water that build as you walk near them in the distance ...
I plan to use the fog to my advantage to help mask this, I may have to use one of these four wall structures for each sim and just not add any colision to it so that character will walk past each one...

As its transparent they should blend together perfectly..

Just an idea..
Mochino
Posts: 12
Joined: Sat Jun 11, 2005 5:21 am

Post by Mochino »

Thank you man!
irkab1rka
Posts: 9
Joined: Sat Jul 09, 2005 8:06 pm

fog on skybox, thoughts

Post by irkab1rka »

I had the same problem but i wonder if I have the skybox shaded by fog then why even bother with this. THe skybox should be drawn as it was covered by the fog due we use static fog here (there is no wind which might change the density of the fog so some details can be revieled for awhile) so technically your view on the skybox won't ever change.

The transparent wall idea sounds perfect, but please let me know if you have any problem with walking around block houses (cityscape) so there will be intersection between the house far away and the transparent walls.

Also your transparent wall idea just gave me abother one: I don't like the skybox because it is impossible (very hard :) to get the clouds movin' so I'll have to abandon the skybox and use your idea because then I have perfect control over the fog and the sky above my virtual self image ;)

thanks for the tip.
Post Reply