On 11/4/2011 11:40 AM, Robert Osfield wrote:
Hi Paul,
We might be looking at two bugs here:
1) .osg isn't supporting shared primtive sets (what is the status
for the other
formats like .osgt?)
Thanks for the reply, Robert. My example was for .osg, but none of the native
serializers (.osg, .ive,
.osgt, or .osgb) support shared PrimitiveSets (see original post).
2) merge geometry is not handling cases where primitives are shared,
I'm not quite sure whether this is really a bug though, in some cases
merging only non shared primitive sets might be the thing to do, but in
other cases duplicating shared primtive sets and then merging might
be better. Perhaps an option for choosing would be appropriate, or
perhaps just leaving it to users to explictly duplicated shared elements
in the scene graph.
MergeGeometryVisitor is intentionally written to not do merging under conditions
specified in the geometryContainsSharedArrays() member function. If modifying
FSTDSSV to deep copy the PrimitiveSets is out of the question, then enhancing
MGV makes good sense.
-Paul
I think the first thing to tackle is item 1 as it's clearly a bug.
Robert.
On 4 November 2011 17:01, Paul Martz<[email protected]> wrote:
Hi all -- I've attached a test file that demonstrates a mismatch in the
behavior of the native OSG plugins and the osgUtil Optimizer. In a nutshell,
when FLATTEN_STATIC_TRANSFORMS_DUPLICATING_SHARED_SUBGRAPHS copies a
subgraph, it fails to set the DEEP_COPY_PRIMITIVES flag bit, resulting in
PrimitiveSet instances being shared by the copied Geometry objects
(Optimizer.cpp 4666). However, none of the native serializers (.osg, .ive,
.osgt, or .osgb) support shared PrimitiveSets.
You can reproduce the resulting inconsistency with the following steps:
set OSG_NOTIFY_LEVEL=INFO
set
OSG_OPTIMIZER=FLATTEN_STATIC_TRANSFORMS_DUPLICATING_SHARED_SUBGRAPHS:MERGE_GEOMETRY
osgconv test.osg result.osg
This incorrectly fails to merge the Geometry objects because the shared
PrimitiveSets created in the first pass prevent the merging of Geometry
objects. (Output shows 4 Geometry objects, indicating a failure to merge.)
In contrast:
set OSG_OPTIMIZER=FLATTEN_STATIC_TRANSFORMS_DUPLICATING_SHARED_SUBGRAPHS
osgconv test.osg intermed.osg
set OSG_OPTIMIZER=MERGE_GEOMETRY
osgconv intermed.osg result.osg
This process correctly merges the Geometry objects, because going out to
file eliminates the shared PrimitiveSets, allowing the MERGE_GEOMETRY to
correctly perform its task. (Output shows 2 Geometry objects, indicating a
successful merge.)
Intuitively, both cases should behave the same, either they should both
merge, or both fail to merge. My preference would be to deep copy the
PrimitiveSets in the Optimizer so that both cases merge. Are there any
reasons why I shouldn't proceed with such a fix?
Thanks,
--
-Paul Martz Skew Matrix Software
http://www.skew-matrix.com/
_______________________________________________
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
--
-Paul Martz Skew Matrix Software
http://www.skew-matrix.com/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org