Hi John,

Back face culling will only be effective at improving performance on
applications that are fill limited, if the bottleneck is elsewhere
then you won't see an improvement in performance.

I cannot say whether you are fill limited or not, the way to check it
is to change the size of the viewport and then look at the performance
- if performance goes up as you reduce the viewport size then you are
fill limited.

Robert.

On 27 May 2012 19:12, John Moore <[email protected]> wrote:
> Hello,
> I am developing an application for iphone and ipod touch using 
> openscenegraph. It is an augmented reality application and I have to load a 
> very complex model. The original 3d model has 5 million vertices.
> Since I am using a mobile platform which is limited in computational power I 
> simplified the model using 3d studio max. I reduced the size of the model 
> from 500Mb to 4.2 Mb using proOptimizer.
> The model now has in total about 36,000 vertices and about 53,000 faces.
>
> I am able to render it but frame rate is slow. I'd like to improve 
> performance using back face culling. The point is I don't know how to 
> activate it (if it is possible):
> I tried with these lines of code but frame rate is still low:
>
> Code:
>
> osg::StateSet* ss = _root->getOrCreateStateSet();
> osg::CullFace* cf = new osg::CullFace(osg::CullFace::BACK );
> ss->setAttribute( cf );
>
>
>
> I am using OpenGL ES 2.0 and shaders.
>
> I setup the camera in this way:
>
> Code:
>
> //set the clear color of the camera to be transparent
> _viewer->getCamera()->setClearColor(osg::Vec4(0.0f, 0.0f, 0.0f, 0.0f));
> //set the clear mask for the camera
> _viewer->getCamera()->setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
> _viewer->getCamera()->setRenderOrder(osg::CameraNode::PRE_RENDER);
> _viewer->getCamera()->setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR);
>
>
>
>
> I use DO_NOT_COMPUTE_NEAR_FAR because I need to set manually projection and 
> viewMatrix at every drawing cycle.
>
> I also initially set viewport like this:
>
> Code:
>
> _viewer->getCamera()->setViewport(new osg::Viewport(0, 0, 
> graphicsContext->getTraits()->width, graphicsContext->getTraits()->height));
>
>
>
>
> The hierarchy of my object is structured as:
>
> _root is a osg::MatrixTransform
>
> my 3d model is divided in subparts.
> all the subparts of my 3d model are direct child of _root and are of type 
> osg::Node
>
> I hope you can give me some tips to improve performance. If you need some 
> other information about my setup I will be glad to give it.
>
> Thank you.
>
> Greetings,
> John
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=47880#47880
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to