Hi Terry, A glatten static transforms that have duplicates shared subgraphs would be a useful addition to osgUtil::Optimizer so if you are willing to tidy up and submit it'd be appreciated.
Cheers, Robert. On Thu, Jan 31, 2008 at 9:56 PM, Terry Welsh <[EMAIL PROTECTED]> wrote: > I went ahead and wrote a visitor that really does remove all static > transforms. If nodes underneath transforms have multiple parents, it > makes copies so that each child subgraph can be properly transformed. > On my big test case, I remove 911 out of 911 transforms, my model > takes up 10x the memory, and it runs 25-30% faster. It's a good > tradeoff for the app I'm working on. > > There's probably plenty of refinement necessary for corner cases since > I have only tested with 2 models, but if this sounds worthwhile to > anyone else I can fix up a few things and submit it..... > - Terry > > > > Message: 16 > > Date: Tue, 29 Jan 2008 19:28:24 +0000 > > From: "Robert Osfield" <[EMAIL PROTECTED]> > > Subject: Re: [osg-users] trouble with flattening static transforms > > To: "OpenSceneGraph Users" <osg-users@lists.openscenegraph.org> > > Message-ID: > > <[EMAIL PROTECTED]> > > Content-Type: text/plain; charset=ISO-8859-1 > > > > Hi Terry, > > > > You can't flatten a static transform when anything it its subgraph is > > shared with other transforms, if you do flatten it the the object is > > the trying to be in two places at one time, something it can't do, > > what happens to these objects is undefined, in fact quite rightly > > disallowed until you hacked away at it... > > > > The only way to flatten these objects shared beneath multiple > > transforms is to duplicate the subgraph so that each transform has its > > own unique subgraph. This itself has its own penalties in terms of > > performance. > > > > Robert. > > > > On Jan 29, 2008 7:14 PM, Terry Welsh <[EMAIL PROTECTED]> wrote: > > > 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.org > > > > > > _______________________________________________ > 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