[osg-users] Aircraft Getting Invisible ?
Robert Osfield
robert.osfield at gmail.com
Fri May 9 07:34:17 PDT 2008
Hi Umit,
You shouldn't mix SceneView settings of near/far, just set the
CullSettings on the Camera itself, these will be probagated
automatically to any SceneView's used internally by osgViewer for
rendering.
Robert.
On Fri, May 9, 2008 at 3:28 PM, ümit uzun <cush_umit at hotmail.com> wrote:
>
> Hi Robert;
>
> I have tried all your advices and osg::Fog effect works the invisibility problem. I try to other ;
>
> 1 - changing setNearFarRatio' value,
>
> 2 - adding viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR ); pattern and
>
> 3 - osg::CullStack::CullingMode cullingMode = sceneview->getCullingMode();
> cullingMode &= ~ ( osg::CullStack::SMALL_FEATURE_CULLING );
> sceneview->setCullingMode( cullingMode );
> // You can also control the size of the screen space that is used to cull
> // small features with
> sceneview->setSmallFeatureCullingPixelSize( minimumSize );
>
> but any of them didn't help me. So why the osg::fog effect fix the problem?
> I guess; it reduce the detail of scene and so this has resulted of protecting the models visibility. Does it could be right ?
>
> Thanks so much Robert :)
>
> ÜMİT UZUN
>
> ----------------------------------------
>> Date: Wed, 7 May 2008 09:38:08 +0100
>> From: robert.osfield at gmail.com
>> To: osg-users at lists.openscenegraph.org
>> Subject: Re: [osg-users] Aircraft Getting Invisible ?
>>
>> Hi Umit,
>>
>> I'd guess that you are probably coming across a near plane clipping
>> issue, rather than a culling issue. Unfortunately its easy to confuse
>> clipping with culling when you just see disappearing, but its too very
>> different mechanisms at play so its important to work out whether it
>> is clipping or culling that is at play. The way to know is study how
>> the object disappears - does it slowly get eaten away or does it just
>> pop out of existance - the former will be near plane clipping down on
>> the GPU, the later most likely culling.
>>
>> Both clipping and culling problems can be caused by incorrect bounding
>> volume computations - if your plane was a custom drawable or you'd
>> just a shader to modify its geometry then this might be a candidate.
>> If you are using standard osg::Geometry then its very unlikely that
>> culling as at fault as the OSG's native codes for computing bounding
>> volumes and doing cull testing are very well established and tested.
>>
>> My guess is that most likely you have an issue with near plane
>> clipping, and if you have a very large model extents this can be very
>> common - as the far plane will be pushed out so far. The OSG does
>> have support for cluster culling, and this will be used by default in
>> geocentric databases built by VPB, this will cull out tiles beyond the
>> horizon line and pull in the max far distance, but it doesn't solve
>> all the potential problems as the furtherest tile can still be a long
>> way out. If you want to pull it in further you could manually
>> control it but then 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. If you use this trick then disabling the compute of near
>> far will be required. You should be able to enable the far clipping
>> plane as well.
>>
>> The other thing you can do is to reduce the NearFarRatio by setting
>> setNearFarRatio to something lower than it's default of 0.0005f ( see
>> src/osg/CullSettings.cpp's setDefaults() method where it's set.)
>>
>> Robert.
>>
>> Robert.
>>
>> 2008/5/5 ümit uzun :
>>>
>>> Hi all,
>>>
>>> I have an aircraft. I resize it and add scene on the earth but it get invisible when I resized much smaller like that,
>>>
>>> float size = 0.0005f / mAircraftModel.get( )->getBound( ).radius( );
>>>
>>> mAircraftTransform->setDataVariance( osg::Object::STATIC );
>>> mAircraftTransform->setMatrix( osg::Matrix::scale( size, size, size ) *
>>> osg::Matrix::rotate( osg::DegreesToRadians( 90.0f ), 1.0f, 0.0f, 0.0f ) *
>>> osg::Matrix::rotate( osg::DegreesToRadians( -90.0f ), 0.0f, 0.0f, 1.0f ) *
>>> osg::Matrix::rotate( osg::DegreesToRadians( 5.0f ), 1.0f, 0.0f, 0.0f ) );
>>>
>>> Earth size is,
>>>
>>> float size = 2000.0f / mTerrainModel.get( )->getBound( ).radius( );
>>>
>>> mTerrainTransform->setDataVariance( osg::Object::STATIC );
>>> mTerrainTransform->setMatrix( osg::Matrix::scale( size, size, size ) );
>>>
>>> What can I do for protect the aircraft visibility?
>>>
>>> Thanks so much!
>>>
>>>
>>> ÜMİT UZUN
>>>
>>> _________________________________________________________________
>>> Şimdi aileye katılmanın tam zamanı - Yeni nesil Ücretsiz Windows Live Hizmetlerini şimdi edinin!
>>> http://get.live.com
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users at lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> _________________________________________________________________
> Şimdi aileye katılmanın tam zamanı - Yeni nesil Ücretsiz Windows Live Hizmetlerini şimdi edinin!
> http://get.live.com
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
More information about the osg-users
mailing list