If you have a transform tree, with the following:
A: translate (0, 10, 0)
|
---B: translate( 0, 5, 0 )
|  |
|  --- Model 1
|
---C: translate( 0, 20, 0 )
   |
   --- Model 2

Then A cannot be flatten with B and C, because B != C.  If A, B, and C
were flattened into a single transform, then Model 1 or Model 2 would
end up in the wrong place.

If you really want them flattened, then you could translate all vertices
in Model 2's geometry by 15 along the Y to account for the difference in
C.  However, doing this in general could introduce numeric error if your
models span a wide area.

It's sort of a balancing act, where you try to group nearby models,
modify their geometries to share a common origin, and apply a single
transform to all of them.  However, because that action requires
knowledge of the lower scene graph, an optimizer can't do it for you.
Also, this wouldn't work with paged children without saving out the
modified geometry, and you'd have to apply different techniques to make
it work on non-geometry drawables.

Hope that helps,
Chase



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:osg-users-
> [EMAIL PROTECTED] On Behalf Of Terry Welsh
> Sent: Tuesday, January 29, 2008 11:14 AM
> To: osg-users@lists.openscenegraph.org
> Subject: [osg-users] trouble with flattening static transforms
> 
> So I have a big city database that I built in Creator with lots of
> external models loaded under transform nodes.  I assumed that
> Optimizer could flatten this out for me with
> FLATTEN_STATIC_TRANSFORMS.  Unfortunately, I only end up flattening 35
> out of 911 transforms.
> 
> Tracing through the code, I find that line 804 of Optimizer.cpp is
> where things go bad for me:
> 
> if (_firstMatrix!=matrix) _moreThanOneMatrixRequired=true;
> 
> This line rejects most of my flattening because later on
> _moreThanOneMatrixRequired seems to be used to decide whether or not
> to flatten.  If I comment this line out, then all but the first
> instance of each model disappears from my scene.
> 
> Understanding all the logic in Optimizer.cpp could take me a long
> time.  Is there some fundamental reason why having more than one
> matrix makes it impossible to flatten a model, or is this just
> incomplete code that I could extend to give me a more thorough
> flattening?  Any tips on how to try and extend it would be great
> too....
> --
> Terry Welsh - mogumbo 'at' gmail.com
> www.reallyslick.com  |  www.mogumbo.com
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to