Hi Dimi,

The Optimizer class do in general work very well at their job, but
they do choose not to be overly aggressive in the optimizations and
requiring DataVariance to be STATIC is one of these protections.   If
you data isn't STATIC then you need to look into why it isn't.

Also w.r.t State optimization - there are two parts the first is
optimization of StateAttribute's so that all attributes that can be
shared are shared, then a second pass that compares the StateSet's,
and here it can just use pointer comparisons, and doesn't need to do a
deep compare, and the previous pass will have removed all the
duplicates.

You make no mention of which version of the OSG you are using, so
there is no way we can tell whether you are using the latest
improvements/fixes to the Optimizer classes, if you aren't then just
upgrade as it's pointless trying to debug something that is already
fixed.

Robert.

On Mon, Oct 6, 2008 at 7:40 PM, dimi christop <[EMAIL PROTECTED]> wrote:
> A while ago I asked the list why the StateVisitor::Optimizer was not working 
> and why I had very poor optimizing results.
> I was prompted by more experienced user to investigate the source myself....
> This is what I did and I found a few tricks which will make the optimizer 
> work very well.
> This holds especially true if you are building you own geometry of do your 
> own loader plugin.
>
> 1) Flag the DataVariance of all Attributes and osg::Objects as STATIC unless 
> you want otherwise. I noticed that at least 80% of the optimizer classes
> skip states for optimization if the Attributes are not flagged as STATIC. So 
> "NO STATIC NO OPTIMIZATION".
>
> 2) Especially for the StateVisitor::Optimizer class there is also something 
> else to consider.  This Optimizer class should merge all the
> similar StateSets, but in my example even though the StateSets had exactly 
> the same attributes and values they never go merged.
> Looking further into that matter I found out that the StateVisitor does a 
> shallow compare when checking two StateSets for equality,
> this means that it looks if the pointers and not their contents are the same. 
> Although OSG supports StateSets compares which take into account the contents 
> of the Attributes
> there is no way to pass this flag into the StateVisitor::Optimizer class. So 
> there are two solutions if you want it to work
> a) Mess with the source
> b) When creating the StateSets take care to attach instanced Attributes 
> whever possible, by reusing the same pointer if the StateSets Attributes have 
> the same values.
>
> In general look up yourself the source whenever the optimizer is not working 
> as expected. Also dont always use the DEFAULT_OPTIMIZATION flags there are 
> many more flags
> which can be used to produce better results. Like the MERGE_GEOMETRY or 
> TRISTRIP_GEOMETRY flag. Also sometimes running 2 consecutive optimizer passes 
> with the same flags produces better results than only one pass. Experimenting 
> is the key.
>
> Dimi
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to