Problem in Fog

isa

08-04-2009 09:01:41

Hello everyone, i m using Caelum in my application and its works fine, but now i want to implement Caelum's ground fog.

here are the lines which i wrote for this purpose.


mCaelumSystem->setManageSceneFog(true);
mCaelumSystem->setSceneFogDensityMultiplier(0.005);

Caelum::GroundFog* fog = new Caelum::GroundFog(mSceneMgr,??????????????????,"CaelumGroundFogDome","CaelumGroundFogDome");
fog->setDensity(1);
mCaelumSystem->setGroundFog(fog);


Now i m confued in the 2nd parameter value , if i set Ogre::SceneNode *caelumRootNode, it gives me following error :

"Error 'caelumRootNode' : undeclared identifier"
'Ogre::SceneNode' : illegal use of this type as an expression "

kindly tell me how i set the fog in my scene (for covered my terrain, mesh objects and so on....)

kindly help me in this regard asap. as i m new in ogre so may be this is a bit stupid question but this still confusing me how i handle in my application using Caelum.

Thanx in Advance.

DarkHorizon

08-04-2009 15:02:44

Using mSceneMgr->getRootSceneNode() works for me ...

isa

09-04-2009 07:09:20

Hi DarkHorizon, thanx for ur reply, but its still not working for me :(.

DarkHorizon

09-04-2009 11:00:35

Hi isa,

Can you post more details about what exactly is not working? Compiler error? Screenshot?

Thanks,

cdleonard

09-04-2009 19:20:42

Don't do this; that component is deprecated.

Caelum::GroundFog tries to control parameters in multiple materials. That's a difficult technique to pack in a shared library and this particular implementation is not very good.

Also; you can get all the same functionality using Caelum::DepthComposer without having to modify your materials.

Sorry.

isa

13-04-2009 05:40:01

Hello cdleonard, i also do this with Depth shader but still not getting the fog. here are the code :

mCaelumSystem->setDepthComposer(new Caelum::DepthComposer (mSceneMgr));

//Caelum::DepthComposerInstance* inst = mCaelumSystem->getDepthComposer ()->getViewportInstance (mWindow->getViewport(0));
//inst->getDepthRenderer()->setRenderGroupRangeFilter (20, 80);
//inst->getDepthRenderer()->setViewportVisibilityMask(~0x00001000);

mCaelumSystem->forceSubcomponentVisibilityFlags(0x00001000); (but it gives me error on this value), i dont know abt this value.

mCaelumSystem->setGroundFogDensityMultiplier (1);
mCaelumSystem->getDepthComposer ()->setGroundFogVerticalDecay (0.06);
mCaelumSystem->getDepthComposer ()->setGroundFogBaseLevel(2);

mCaelumSystem->getDepthComposer ()->setGroundFogEnabled (true);
mCaelumSystem->getDepthComposer ()->setGroundFogDensity(0.9);
mCaelumSystem->getDepthComposer ()->setGroundFogColour(Ogre::ColourValue(1,1,1));
mCaelumSystem->getDepthComposer ()->setSkyDomeHazeEnabled(true);



kindly tell me how i m able to apply fog on my scene and on my ground, plz its realy very urgent. Thanx in Advance.

P51D_Ace

09-05-2009 21:23:10

I was able to get fog to display in my environment, but it would render in front of my mesh.

I was using the same code as above:


mCaelumSystem->setDepthComposer(new Caelum::DepthComposer(mSceneMgr));
mCaelumSystem->setGroundFogDensityMultiplier (0.03);
mCaelumSystem->getDepthComposer ()->setGroundFogVerticalDecay (0.06);
mCaelumSystem->getDepthComposer ()->setGroundFogBaseLevel (0);
mCaelumSystem->getDepthComposer()->setGroundFogEnabled(true);


I have attached two image files, one with this code and one without. You can definitely see that the fog code here is causing the fog to render in front of the inside part of my mesh. I have tried many flags in the material file with no success to force the fog to render the inside face of the mesh in front of the fog. I looks like the outside of the mesh object is fine.

Has anyone else had any problems like this?

cdleonard

19-05-2009 23:23:27

P51D_Ace: The DepthComposer class use a separate depth render; and it seems that your objects are not correctly rendered in the depth texture. You can confirm that with:


mCaelumSystem->getDepthComposer ()->setDebugDepthRender (true);


Caelum tries to automatically derive a depth-rendering pass from your objects; but it doesn't seem to work here (it only works for very simple cases). In particular it won't work with any sort of vertex program deformation/animation. You can provide your own depth rendering technique in any such material: just add a technique with scheme set as "CaelumDepth".