Hi everyone,

Recently I've noticed some issues with the optimizer which I'd like to fix. 
However, I'd like to request some feedback on what the best course would be.

I have a file like this

Code:

Group
    Transform
        Group (UniqueID 1)
            Geode 1
                StateSet (UniqueID 2)
                Geometry 1
            Geode 2
                StateSet (UniqueID 2)
                Geometry 2
            Geode 3
                StateSet (UniqueID 2)
                Geometry 3
    Transform
        Group (UniqueID 1)




I would like to optimize this to:

Code:

Group
    Geode
        StateSet
        Geometry




It is not possible to do this in a single pass with the optimizer. Using 
optimizer settings
FLATTEN_STATIC_TRANSFORMS_DUPLICATING_SHARED_SUBGRAPHS MERGE_GEODES 
MERGE_GEOMETRY REMOVE_REDUNDANT_NODES COPY_SHARED_NODES
gets me quite far:

Code:

Group
    Geode
        StateSet
        Geometry 1
        Geometry 2
        Geometry 3
        Geometry 4
        Geometry 5
        Geometry 6



, but the final geometry nodes aren't merged because the Geometry is still 
sharing the same vertex arrays (1 and 4, 2 and 5, 3 and 6).
The COPY_SHARED_NODES setting helps to reduce the different nodes (because they 
are then merged), but it doesn't do anything to the data inside Geode nodes. 
Note that if I save the last file to disk, and then reconvert with the same 
optimizer settings, then the contents of the geometries is fully written to 
file, and on the second conversion OSG doesn't know that the geometries were 
linked, so happily merges them.

The 'correct' solution I think is to add a function to 
CopySharedSubgraphsVisitor that also duplicates the contents of a Geode node. 
After that the MERGE_GEOMETRY setting should kick in and merge the resulting 
geometries into a single geometry.

I hope someone can give me some input on the best way to handle this issue. If 
I wasn't clear enough about the problem, please let me know and I can post a 
complete osg file.

Thank you!

Cheers,
Rick

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=26734#26734





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

Reply via email to