Hi Zoltan;

I get your all advice for fixing invisibility problem, thanks so much. But 
unfortunately any of them couldn't fix the invisibility problem. Then I try to 
Robert's osg::Fog advice. And it works amazingly :) It's so simple way to 
fixing invisibility problem in which using so big and so small models. And it 
reduces the detail of models so the performance of your program get faster. So 
any of models couldn't get clip or cull from the viewport.

The way of solution for my program like that;

// adding fog effect to any node
osg::StateSet *state= mTerrainModel->getOrCreateStateSet();  // you should use 
a stateset which node you want to effect with fog.
osg::Fog *fog = dynamic_cast(state->getAttribute(osg::StateAttribute::FOG));
if (!fog) fog = new osg::Fog;
fog->setColor(osg::Vec4(1.,1.,1., 1.));  // white fog effect
fog->setDensity(0.0000005f);   // Density of fog. you try the value of density 
for your models.
fog->setFogCoordinateSource(osg::Fog::FRAGMENT_DEPTH);  // it effects the 
models part of which is far or away your viewport 
state->setAttributeAndModes(fog,osg::StateAttribute::ON);

All of this. You can add this code pattern to your model loading class, 
function or anywhere and you can see very good scene when flying on the 
terrain. 
It's awesome:) I hope it will help you, and if you have any problem with fixing 
this effect I can help.

Good Bye...


ÜMİT UZUN

----------------------------------------
> From: [EMAIL PROTECTED]
> To: [email protected]
> Date: Wed, 7 May 2008 11:27:33 +0200
> Subject: [osg-users]  osg::Fog (was: Aircraft Getting Invisible ?)
> 
> Robert Osfield wrote on Wednesday 07 May 2008:
> 
>> 2008/5/5 ümit uzun :
>>>  I have an aircraft. I resize it and add scene on the
>>> earth but it get invisible when I resized much smaller
>>> like that,
> 
>> you'll need to make sure you use 
>> glFog/osg::Fog on the terrain to make sure that you can
>> only see up to a set maximum distanace.
> 
> Hi Ümit,
> 
> if you manage to get this osg::Fog working for you, would 
> you post your solution ? Because it's something I'd need 
> too for zSim.
> 
> Robert,
> 
> there is no example about osg::Fog, only help are the 
> include files ... tough. Can you point to some simple 
> implementation, for a small (some meters) model in a BIG 
> scenery (several km), and with a fog starting at say 10km, 
> fully opaque at 20km ?
> 
> Thanks & bye-bye
> 
> Zoltán
> 
> 
> 
> 
> -- 
>  
> ____________________________________
> 
> Zoltan
> 
> http://sourceforge.net/projects/zsim
> ____________________________________
> 
>  
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_________________________________________________________________
Windows Live Spaces – hayatınız, Alanınız. Daha fazlasını öğrenmek için buraya 
tıklayın.
http://get.live.com/spaces/overview
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to