[osg-users] AutoTransform, ROTATE_TO_SCREEN and small feature culling

Robert Osfield robert.osfield at gmail.com
Tue Mar 27 00:31:01 PDT 2018


Hi Hartwig,

CullingActive flag is only effective for the Node that you set it for
and all it's parents, it doesn't disable culling for the children of
the node with CullingActive set.

Robert.

On 26 March 2018 at 22:28, Hartwig Wiesmann <hartwig.wiesmann at skywind.eu> wrote:
> Hi,
>
> I found a very old article covering this issue: https://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg15948.html. In the meantime it seems to be that proposal (2) has been implemented and the AutoTransform's computeBound() method returns an invalid bounding sphere during the first cull traversal. Nevertheless, when checking in the example osgautotransform.cpp the bounding spheres (of the text messages) remain invalid. To check this I have added an update callback to the AutoTransforms that only checks the validity of the bounding sphere.
>
> Now, if the bounding sphere remains invalid culling of the AutoTransform's children will not be correctly performed because the AutoTransform's isCullingActive method will always return false (bounding sphere is invalid).
>
> To solve this issue I was thinking to add a ComputeBoundingSphere callback or an update callback to the AutoTransform. But this is not a good solution because in this case I have to calculate always a new bounding sphere as I do not have access to the node's "_boundingSphereComputed" flag.
>
> Another solution is to patch the node's getBound() method that will set the flag "_boundingSphereComputed" only to true if a valid "_boundingSphere" exists. This sounds reasonable in any case:
>
> Code:
>         inline const BoundingSphere& getBound() const
>         {
>             if(!_boundingSphereComputed)
>             {
>                 _boundingSphere = _initialBound;
>                 if (_computeBoundCallback.valid())
>                     _boundingSphere.expandBy(_computeBoundCallback->computeBound(*this));
>                 else
>                     _boundingSphere.expandBy(computeBound());
>
>                 _boundingSphereComputed = _boundingSphere.valid();
>             }
>             return _boundingSphere;
>         }
>
>
>
> But I do not know if this breaks anything.
>
> Is there any other method to get a valid bounding sphere for the AutoTransform without sacrificing performance?
>
> Thank you!
>
> Cheers,
> Hartwig
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=73174#73174
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


More information about the osg-users mailing list