So... your suggestion is to optimize the 3d model reducing the number of 
vertices because face culling will not improve performance? 
Can you argue more about why is like that?
Thank you.
John

On May 29, 2012, at 11:26 PM, Paul Martz wrote:

> Enabling face culling will improve performance only when rendering is 
> fill-limited. If you're vertex-limited, face culling will not affect 
> performance.
>   -Paul
> 
> 
> 
> On 5/29/2012 2:48 PM, Gio 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 );
>> [/code]
>> 
>> 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);
>> [/code]
>> 
>> 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));
>> [/code]
>> 
>> 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 Moore
>> _______________________________________________
>> 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

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to