This is fog effect test. I set fog over nodes, and succeeded. But look at ground and background. Background must be hided by the fog according to natural rule, too. Only nodes were being hided and oddly rendered white.
I would like the effect that nodes disappear into the fog and appear from the fog naturally. Can I do so? How likely?
1-near
2-distant
3-far more distant
Fog problem
Fog problem
Last edited by gogo on Fri Jul 18, 2008 11:41 pm, edited 1 time in total.
Q
Hi, JP.
Indeed fog can be applied to a normal mesh.
However ITerrainSceneNode does not have "setMaterialFlag", so fog cannot be applied about terrain.
My code to create terrain is:
That is the reason why I am at a loss.
Indeed fog can be applied to a normal mesh.
Code: Select all
mesh->setMaterialFlag(EMF_FOG_ENABLE, true);
My code to create terrain is:
Code: Select all
ITerrainSceneNode* terrain = smgr->addTerrainSceneNode(
"terrain.bmp",
0, // parent node
-1, // node id
vector3df(-400.f, 0.f, -400.f), // position
vector3df(0.f, 0.f, 0.f), // rotation
vector3df(4.f, 0.1f, 4.f), // scale
SColor ( 255, 255, 255, 255 ), // vertexColor,
5, // maxLOD
ETPS_17, // patchSize
4 // smoothFactor
);
terrain->setMaterialTexture(0, driver->getTexture("terrain_texture.bmp"));
terrain->setMaterialType(EMT_DETAIL_MAP);
terrain->setMaterialFlag(EMF_LIGHTING, false);
Last edited by gogo on Fri Jul 18, 2008 2:42 pm, edited 1 time in total.
What shadows have to do with terrains ?
To enable fog on your nodes, just do node->setMaterialFlag(EMF_FOG_ENABLE, true); (or EMF_FOG_ENABLED, I don't remember exactly).
Edit : Sorry, I just saw your edit.
So, do something like :
Or something like that, I'm not at home so I can't check.
To enable fog on your nodes, just do node->setMaterialFlag(EMF_FOG_ENABLE, true); (or EMF_FOG_ENABLED, I don't remember exactly).
Edit : Sorry, I just saw your edit.
So, do something like :
Code: Select all
for (i = 0; i < node->getMaterialCount(); i++)
{
node->getMaterial(i).FogEnabled = true;
}
I'm Ouverta on the chat |
Project leader/Lead Developer of Ouverta project.
Project leader/Lead Developer of Ouverta project.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Q
Ehh, what now? Of course terrain has the setMaterialFlag, because it's an ISceneNode...gogo wrote: However ITerrainSceneNode does not have "setMaterialFlag", so fog cannot be applied about terrain.Code: Select all
terrain->setMaterialFlag(EMF_LIGHTING, false);
Now it just looks like your skybox isn't affected by the fog, which it just isn't because that doesn't make much sense. The skybox is your horizon and if you've got thick fog going off into the distance you won't see the horizon so you can just get rid of your skybox and change the colour in driver->beginScene() to the colour of you fog.
Your tree leaves also don't seem to be getting fog, not sure why that would be though, unless they're a different node to the trunk?
Your tree leaves also don't seem to be getting fog, not sure why that would be though, unless they're a different node to the trunk?