[SOLVED] How do I add fog?
-
Guest
[SOLVED] How do I add fog?
How can I add the fog effect so that object fade to black in the distance? And please keep the answer simple cause I'm new. Thanks
-
Guest
Code: Select all
video::IVideoDriver* driver = device->getVideoDriver();
driver->setFog(SColor(0,125,125,0),true, 0,4000); //fog color-final values= amount of fog, distance

-
Asterisk Man
- Posts: 62
- Joined: Wed Jun 09, 2004 5:51 am
-
knightoflight
- Posts: 199
- Joined: Sun Aug 24, 2003 5:47 pm
- Location: Germany
-
knightoflight
- Posts: 199
- Joined: Sun Aug 24, 2003 5:47 pm
- Location: Germany
Hello I saw this post and figured id play around with fog some..
Well the code is in and I have no errors..
But I cant see any fog anywhere..
Ive changed the values all of them many times...
Could it be the fog is below my level or above or beside it..
Is there a way to move it around or is a large ground type fog...
Ive never seen the fog in action for irrlicht so wanted to figure it out someday anyway..
I read over the api section for it and everything looks ok.. I dont see anything about vector for placing it in diff locations..
Where exactly does the fog appear with your code afecelis?
Well the code is in and I have no errors..
But I cant see any fog anywhere..
Ive changed the values all of them many times...
Could it be the fog is below my level or above or beside it..
Is there a way to move it around or is a large ground type fog...
Ive never seen the fog in action for irrlicht so wanted to figure it out someday anyway..
I read over the api section for it and everything looks ok.. I dont see anything about vector for placing it in diff locations..
Where exactly does the fog appear with your code afecelis?
With my level called levelnode:
result (vey soft, orange fog in the corners):

after teaking some values:
result: a denser fog

hope it helps
Code: Select all
levelnode->setMaterialFlag(EMF_FOG_ENABLE,true); //enables fog
driver->setFog(SColor(0,125,125,0),true, 0,4000); //fog color-final values= amount of fog, distance

after teaking some values:
Code: Select all
driver->setFog(SColor(0,125,125,0),true, 0,1000);

hope it helps

With my level called levelnode:
levelnode->setMaterialFlag(EMF_FOG_ENABLE,true); //enables fog
driver->setFog(SColor(0,125,125,0),true, 0,4000); //fog color-final values= amount of fog, distance
Where is the name of your level at lol...
I dont have any name for my level that I know of..
Im kinda lost where you got levelnode from?
Sorry to be a pest like this but I dont understand
levelnode->setMaterialFlag(EMF_FOG_ENABLE,true); //enables fog
driver->setFog(SColor(0,125,125,0),true, 0,4000); //fog color-final values= amount of fog, distance
Where is the name of your level at lol...
I dont have any name for my level that I know of..
Im kinda lost where you got levelnode from?
Sorry to be a pest like this but I dont understand
Code: Select all
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
device->getFileSystem()->addZipFileArchive("./data/irrlicht.pk3");
scene::IAnimatedMesh* level = 0;
level = smgr->getMesh("irrlicht.bsp");
scene::ISceneNode* levelnode = 0;
levelnode = smgr->addOctTreeSceneNode(level->getMesh(0));
levelnode->setMaterialFlag(EMF_FOG_ENABLE,true); //enables fog
levelnode->setPosition(core::vector3df(0,-100,0));
levelnode->setScale( irr::core::vector3df(1,1,1) );
driver->setFog(SColor(0,125,125,0),true, 0,1000); //fog color-final values= amount of fog, distance
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);

