hi,
can someone please give me some fog creation source code . . .
thanks
-zubair-
Fog creation
driver->setFog(...);
is enough, of course with the appropriated parameters (http://irrlicht.sourceforge.net/docu/cl ... r.html#a33)
is enough, of course with the appropriated parameters (http://irrlicht.sourceforge.net/docu/cl ... r.html#a33)
Ok, sorry to jump in on this. I tried that and it crashed:Dogs wrote:YourNode->setMaterialFlag(EMF_FOG_ENABLE,true);
driver->setFog(SColor(0,30,30,30),true, 0,1300);
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
Try something like this..
Code: Select all
// Fog
irr::scene::IAnimatedMeshSceneNode* nodeFog; //Sets its node.
nodeFog->setMaterialFlag(EMF_FOG_ENABLE,true);
driver->setFog(SColor(0,30,30,30),true, 0,1300);
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
![Image](http://img.photobucket.com/albums/v317/RayOfAsh/sigs/lain13.jpg)
Well you dont nead to create a fognode but rather add the fog to a node that you have allready...
For example when I add fog to my levels I chose something like my terrian or if its an inside level i chose the building and attach the fog to that node..
For example lets say I used a bsp for my level... the code is below..
//load bsp level//
device->getFileSystem()->addZipFileArchive("../../media/whatever.pk3");
scene::IAnimatedMesh* mesh = smgr->getMesh("../../media/whatever.bsp");
scene::ISceneNode* node = 0;
if (mesh)
node = smgr->addOctTreeSceneNode(mesh->getMesh(0));
// fog // Apply this to the node you want fog ///
node->setMaterialFlag(EMF_FOG_ENABLE,true);
driver->setFog(SColor(0,30,30,30),true, 0,1300);
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
I dont know the rest of your code but there could be reasons like where you placed this code that would also cause crashes....
For example when I add fog to my levels I chose something like my terrian or if its an inside level i chose the building and attach the fog to that node..
For example lets say I used a bsp for my level... the code is below..
//load bsp level//
device->getFileSystem()->addZipFileArchive("../../media/whatever.pk3");
scene::IAnimatedMesh* mesh = smgr->getMesh("../../media/whatever.bsp");
scene::ISceneNode* node = 0;
if (mesh)
node = smgr->addOctTreeSceneNode(mesh->getMesh(0));
// fog // Apply this to the node you want fog ///
node->setMaterialFlag(EMF_FOG_ENABLE,true);
driver->setFog(SColor(0,30,30,30),true, 0,1300);
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
I dont know the rest of your code but there could be reasons like where you placed this code that would also cause crashes....
I was just browsing around and read over my post here and just saw that i made a mistake in my code..
Well its really not a mistake but could cause problems for sure..
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
This line here enables 32 bit textures and if this line is placed improperly in your code then it can cause crashes yes...
But I always use this line to enable 32 bit textuers as they look much much better...
Try it with your skyboxes...![Smile :)](./images/smilies/icon_smile.gif)
Well its really not a mistake but could cause problems for sure..
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
This line here enables 32 bit textures and if this line is placed improperly in your code then it can cause crashes yes...
But I always use this line to enable 32 bit textuers as they look much much better...
Try it with your skyboxes...
![Smile :)](./images/smilies/icon_smile.gif)
I`ve done something like that on my own. Result: NO FOGDogs wrote: node->setMaterialFlag(EMF_FOG_ENABLE,true);
driver->setFog(SColor(0,30,30,30),true, 0,1300);
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
![Sad :(](./images/smilies/icon_sad.gif)
Than I found this topic and use your code(adapted to my source)
The result is NO FOG!!!
The other code is just for application creation and loading 3ds model.
Could anybody explain that?
-
- Posts: 62
- Joined: Fri Jan 07, 2005 4:37 pm
- Location: California
Using Linux, OpenGL, I have a similar problem...
Whenever I turn on fog, it only gets applied to the ground, basically as a % opacity of the chosen color.
So, in other words, everytime I turn fog on, the ground will turn grey (at 100% or so)
Used the examples on the forum with no luck... Can fog be used with heightmaps or just bsp and such? (which I dont use / havent tried...)
Anyone else have similar problems?
Whenever I turn on fog, it only gets applied to the ground, basically as a % opacity of the chosen color.
So, in other words, everytime I turn fog on, the ground will turn grey (at 100% or so)
Used the examples on the forum with no luck... Can fog be used with heightmaps or just bsp and such? (which I dont use / havent tried...)
Anyone else have similar problems?