Re: [osg-users] osgUtil::Optimizer and osgSim::DOFTransform with data variance STATIC

2012-02-28 Thread Magnus Kessler
On Monday 27 Feb 2012 19:49:53 Jean-Sébastien Guay wrote:
 Hi Magnus,
 
  But maybe this question is more to the authors of osgmaxexporter. Why
  does osgmaxexporter unconditionally set the data variance to STATIC?
  What are the use cases where one would model a STATIC DOFTransform?
 
 DOFTransforms are a relic of Multigen (Presagis) Creator, and in that
 software they were the most widely used transform node. Modelers (as you
 probably know) are fond of putting lots of transforms (and groups) all
 over the scene graph, to keep things understandable to them, and to make
 it easier to modify the model later.
 
 Unfortunately, there are often many of these transforms that aren't
 really useful once the models are in the simulation software. So yes,
 there is a valid use case for static DOFTransforms - transforms that
 were just put there by the modeler for convenience, but which don't have
 any use in simulation.
 
 Now, I agree with you, the STATIC data variance should not be
 unconditionally applied. There can be rules to determine when it should
 be, for example if the DOFTransform does not have any limits.
 
 At my previous employer, we had made a custom osgconv which would
 massage the scene graph before calling the osgUtil::Optimizer on it (I
 think I mentioned this before on this list). This massage is highly
 dependent on what you'll be doing with your data, which is why I don't
 think it would be useful to submit such a thing - OSG provides the tools
 for you to do the right thing in your situation. But just as an example,
 our tool would:
 
 * Normalize state to expected values (we didn't require artists to set
 the right filtering or face culling manually, we enforced it in the
 tools, so that osgUtil::Optimizer's various merge operations could give
 good results)
 * Flag nodes as dynamic if we didn't want them optimized away (we had
 various rules, including if a comment contained Dynamic, if a DOF had
 limits, etc.
 * Remove most Group nodes since these just hinder the merge visitors and
 in most cases, better batching (less draw calls) is more important than
 better spatial culling.
 
 Again, I've talked about these things in the past, and others have
 shared similar or related advice too.
 
 Hope this helps,
 
 J-S

Thanks, Jean-Sebastien, for your detailed explanation. You've effectively 
confirmed what I suspected. In our workflow, where DOFTransforms are only 
occasionally used for a very specific purpose they should never be marked 
STATIC in the first place.

I believe that this is true for all workflows where DOFTransforms are being 
added through the osgmaxexporter. There they require a conscious decision of 
the modeller to add them to the scene through a special osgmaxexporter 
helper object. And as modellers don't really like to use functionality that 
is not native to their tool until they absolutely have no other choice an 
accidental use is rather improbable.

I'll patch osgmaxexporter and take it from there.

Thanks everyone for their contributions on this thread.

Magnus

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


[osg-users] osgUtil::Optimizer and osgSim::DOFTransform with data variance STATIC

2012-02-27 Thread Magnus Kessler
We recently discovered that osgSim::DOFTransform nodes were unexpectedly 
removed from the scene graph by the unconditional use of the 
osgUtil::Optimizer in osgconv. The DOFTransform nodes were marked by our 
modelling tool (Max with the osgmaxeporter plugin) as STATIC.

Should the optimizer flatten DOFTransform nodes at all, under any 
circumstances? They carry much more information than a simple transformation 
matrix, such as the ranges for the DOFs. In our case it was this information 
that needed to be preserved.

Can anyone think of a good use case where one would want to flatten 
DOFTransform nodes with osgconv? After all, if I weren't interested in the 
additional information, I could just use a MatrixTransform...

Regards,

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


Re: [osg-users] osgUtil::Optimizer and osgSim::DOFTransform with data variance STATIC

2012-02-27 Thread Robert Osfield
HI Magnus,

If you make a Transform node as STATIC then you've told the scene
graph that it will never change so will be fair game for the
Optimizer.  You have two choices if you don't want to have the
Optimizer optimize it away:

 1) Don't call the Optimizer with the FLATTEN_STATIC_TRANSFORM enabled.
 2) Make your Transforms which will be changing as DYNAMIC.

Robert.

On 27 February 2012 15:10, Magnus Kessler magnus.kess...@gmx.net wrote:
 We recently discovered that osgSim::DOFTransform nodes were unexpectedly
 removed from the scene graph by the unconditional use of the
 osgUtil::Optimizer in osgconv. The DOFTransform nodes were marked by our
 modelling tool (Max with the osgmaxeporter plugin) as STATIC.



 Should the optimizer flatten DOFTransform nodes at all, under any
 circumstances? They carry much more information than a simple transformation
 matrix, such as the ranges for the DOFs. In our case it was this information
 that needed to be preserved.



 Can anyone think of a good use case where one would want to flatten
 DOFTransform nodes with osgconv? After all, if I weren't interested in the
 additional information, I could just use a MatrixTransform...



 Regards,



 Magnus




 ___
 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


Re: [osg-users] osgUtil::Optimizer and osgSim::DOFTransform with data variance STATIC

2012-02-27 Thread Magnus Kessler
On Monday 27 Feb 2012 15:26:15 Robert Osfield wrote:
 HI Magnus,
 
 If you make a Transform node as STATIC then you've told the scene
 graph that it will never change so will be fair game for the
 Optimizer.  You have two choices if you don't want to have the
 Optimizer optimize it away:
 
  1) Don't call the Optimizer with the FLATTEN_STATIC_TRANSFORM enabled.
  2) Make your Transforms which will be changing as DYNAMIC.
 
 Robert.
 

Hi Robert,

Thanks for your rapid answer.

I understand perfectly well the way the optimizer works and how to get the 
desired behaviour in its current implementation. DYNAMIC DOFTransform is the 
way to go (FLATTEN_STATIC_TRANSFORMS wouldn't work, as these DOFTransform 
nodes are part of bigger scenes, that do benefit from transformation 
flattening). I was just trying to see if there was a good reason to ever set 
the data variance to STATIC on a DOFTransform.

But maybe this question is more to the authors of osgmaxexporter. Why does 
osgmaxexporter unconditionally set the data variance to STATIC? What are the 
use cases where one would model a STATIC DOFTransform?

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


Re: [osg-users] osgUtil::Optimizer and osgSim::DOFTransform with data variance STATIC

2012-02-27 Thread Jean-Sébastien Guay

Hi Magnus,


But maybe this question is more to the authors of osgmaxexporter. Why
does osgmaxexporter unconditionally set the data variance to STATIC?
What are the use cases where one would model a STATIC DOFTransform?


DOFTransforms are a relic of Multigen (Presagis) Creator, and in that 
software they were the most widely used transform node. Modelers (as you 
probably know) are fond of putting lots of transforms (and groups) all 
over the scene graph, to keep things understandable to them, and to make 
it easier to modify the model later.


Unfortunately, there are often many of these transforms that aren't 
really useful once the models are in the simulation software. So yes, 
there is a valid use case for static DOFTransforms - transforms that 
were just put there by the modeler for convenience, but which don't have 
any use in simulation.


Now, I agree with you, the STATIC data variance should not be 
unconditionally applied. There can be rules to determine when it should 
be, for example if the DOFTransform does not have any limits.


At my previous employer, we had made a custom osgconv which would 
massage the scene graph before calling the osgUtil::Optimizer on it (I 
think I mentioned this before on this list). This massage is highly 
dependent on what you'll be doing with your data, which is why I don't 
think it would be useful to submit such a thing - OSG provides the tools 
for you to do the right thing in your situation. But just as an example, 
our tool would:


* Normalize state to expected values (we didn't require artists to set 
the right filtering or face culling manually, we enforced it in the 
tools, so that osgUtil::Optimizer's various merge operations could give 
good results)
* Flag nodes as dynamic if we didn't want them optimized away (we had 
various rules, including if a comment contained Dynamic, if a DOF had 
limits, etc.
* Remove most Group nodes since these just hinder the merge visitors and 
in most cases, better batching (less draw calls) is more important than 
better spatial culling.


Again, I've talked about these things in the past, and others have 
shared similar or related advice too.


Hope this helps,

J-S
--
__
Jean-Sebastien Guay  jean_...@videotron.ca
http://whitestar02.dyndns-web.com/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org