Hi Lv, If you have a scene with a very large distance range then depth precision is an awkward issue to deal with - the lower the near/far ratio the lower the precision. To retain precision you have to either push out the near plane or pull in the far plane, and they work as ratios so doubling the distance of the far plane is equivilant to pulling the far distance by half. You can juggle the exact distance computation but in the end if you need to render something very near and somehing very far you are forced to have a small near and large far values and with it precision issues.
When you are in this situation the only practical thing to do is to depth partition your scene so that you render it into two or more sections. Basically you render the far section first then overlay the nearer sections on top of this, with the overlay sections clearing the depth buffer but not the colour buffer. In OSG 2.8.x there is an osgdepthpartion example that uses a series of in scene graph osg::Camera to set up the partitioning. It's quite clucky and awkward though so I wouldn't recommend. A much easier and flexible means of manage the depth partition is to set up multple slave Camera's in the view to do the job of the depth partitioning, this way the viewer configuration changes when you want to change to depth partition and the scene graph remains the same. In svn/trunk and 2.9.x there is support for creating slave Cameras to do depth partitioning, see the osgshadow example for this. Look for the section that does viewer.setUpDepthPartition(). Robert. On Wed, Jun 8, 2011 at 9:39 AM, Lv Qing <donlvq...@msn.com> wrote: > Hi, > > My applicaiton use a quiet large terrain model (about 4000KM*4000KM),and when > I viewing some very small flying objects(about 20m*20m) above the terrain > ,the object seems been culled. > > I know it is the Near and Far Plane issue,so I > > setComputeNearFarMode(osg::CullSetting::COMPUTE_NEAR_FAR_USING_PRIMITIVES); > setNearFarRation(0.0001); > > It solves the problem,make the small objects visible. > > However it causes another problem ,I have also loaded some vector GIS > models (such as roads,country boundraies) which made by osgGIS. When I > COMPUTE NEAR FAR USING PRIMITIVES,the vector models cause me 50% ~60% CPU > usage!When I disabled COMPUTE NEAR FAR USING PRIMITIVES,or hiding the vector > models ,it only cost me 10%~15% CPU usage.The vector models is only 3.5mb. > > Is there a better solution to solve this problem? > Thank you! > > Cheers, > Lv > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=40196#40196 > > > > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org