I'm trying to implement frustum culling in my application. My geometry is
contained in bounding boxes. So I create a polytope with the camera matrices:
Code:
osg::Matrix viewMatrix;
viewMatrix.identity();
viewMatrix.makeLookAt(...);
osg::Matrix projectionMatrix;
projectionMatrix.identity();
projectionMatrix.makePerspective(...);
osg::Matrix mvpw = viewMatrix * projectionMatrix;
//osg::Matrix mvpi = osg::Matrix::inverse(mvpw);
osg::Polytope frustum;
frustum.setToUnitFrustum();
frustum.transform(mvpw);
Like this the intersection with the other bounding boxes fails, the only way I
can get it to work is:
Code:
osg::Matrix mvpw = viewMatrix * projectionMatrix;
osg::Matrix mvpi = osg::Matrix::inverse(mvpw);
osg::Polytope frustum;
frustum.setToUnitFrustum();
frustum.transform(mvpi);
This doesn't make sense, if I understand correctly this would invert the mvp
matrix twice, one time I invert it and then polytope.transform converts it.
Another funny thing is that using frustum.transformProvidingInverse(mvpi); also
doesn't work.
I'm using OSG 3.0.1.
Thank you in advance![/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56410#56410
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org