[osg-users] Using SSE within OSG
Mathias Fröhlich
M.Froehlich at science-computing.de
Wed Jul 30 01:05:20 PDT 2008
James,
The most obvious problem: Group::traverse ...
Is one of the visitors you use a TRAVERSE_ALL_CHILDREN visitor? If so, the
Group::traverse profile makes sense. Make sure that you do traverse only this
subgraphps you need to traverse. You can then minimize that calls too. Will
help overall!!!
Ok, so the PositionAttitudeTransform is the matrix multiplication problem.
Try that specialized transform patch I have sent to you.
That will help a bit here. But you might do even better:
You are talking about a game. So I expect that you have transform nodes to
animate parts of the scenegraph.
I agree that you will need the full PositionAttitudeTransform in some cases.
But I can well imagine to have special transforms in such a game where you can
make use of specialized implementations.
Specialized with respect to:
* The kind of the transform.
Often you just have to rotate around the origin. Nothing more. Or you might
have some linear transform to make something move but no rotation and no
scaling.
For this case implement you own say LinearTransform or RotationTransform nodes
derived from osg::Transform and reimplement the the computeLocalToWorldMatrix
and computeWorldToLocalMatrix and computeBound methods with something more
optimized. May be use that specialized preMultTranslate or equivalent methods
from the patch I sent. You can avoid many matrix multiplications for that.
* Recomputation of the bounding sphere.
Sometimes with such special transforms, you do not need to dirty the bounding
sphere.
Take a rotation. Say you have a leg that can rotate around the knee. Just
compute the bounding sphere for all possible rotation values of that
rotation. With that you will have slightly worse bounding spheres, but You do
not need to walk large scenegraphs to invalidate the bound and you do not
need to recompute the bound for large parts of the scene again and again.
If you have a human body for example with many transform nodes for arms legs
and fingers and so on. Your human body bounding sphere will not be much
larger with that kind of bounding box compared to the exact case. The
interresting cull case is to cull away the *whole* human body which will
happen about the same as with the exact bounding spheres.
Translations along an axis for example are a bit more difficult in this case
since they would blow up the sphere to infinity if you want to catch any
translation value. But if you have a translation axis, a maximum scalar value
a minimum scalar value and a current scalar translation value, you can do
about the same.
Hope this helps.
Greetings
Mathais
--
Dr. Mathias Fröhlich, science + computing ag, Software Solutions
Hagellocher Weg 71-75, D-72070 Tuebingen, Germany
Phone: +49 7071 9457-268, Fax: +49 7071 9457-511
--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Florian Geyer,
Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Prof. Dr. Hanns Ruder
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196
More information about the osg-users
mailing list