[osg-users] Culling with custom clip planes

Jannik Heller scrawl at baseoftrash.de
Sat Oct 24 09:02:10 PDT 2015


Hi Robert,

I have just noticed that approach of adding culling planes doesn't work 100% accurately. Some meshes that have their bounding box fully outside of the culling plane don't get culled.

To test with please check the attached osgreflect.cpp. I added a culling plane so that everything above the mirror mesh should get culled. The aircraft and the sphere are clearly above, but don't get culled for some reason:

https://i.imgur.com/ip0iIc9.png

Once I move the sphere up by 2 more units then it gets culled.
        transform->setMatrix(osg::Matrix::translate(osg::Vec3f(20, 20, z + sphereRadius + 4)));

For the aircraft, the inaccuracy seems to be larger. I have to move the culling plane down by 21 units before the aircraft gets culled:

    rootNode->addCullCallback(new PlaneCullCallback(osg::Plane(osg::Vec3d(0,0,-1),osg::Vec3d(0,0,z-21))));

Any ideas why this could be happening?

Thanks,
Jannik

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65431#65431



-------------- next part --------------
A non-text attachment was scrubbed...
Name: osgreflect.cpp
Type: text/x-c++src
Size: 17157 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151024/9d9ed498/attachment-0002.cpp>


More information about the osg-users mailing list