[osg-users] Optimizer StateVisitor not working

dimi christop dimi_christop at yahoo.com
Sat Sep 27 10:44:05 PDT 2008


Hi Robert,
I already done that before posting, without success. 
This is why I also attached the .osg file which clearly shows a test situation.
Loading up that file using the osgViewer and setting the OPTIMIZER flags as described in my first mail shows that clearly.
Can you anything else which might prevent the merge by examining the osg file?
If you want to try it out yourself you can replace the 2 lines
file "Priene-Stadio_Ground.rgb"
and change it to any texture file on your path.

Thanks for the reply
Dimi




----- Original Message ----
From: Robert Osfield <robert.osfield at gmail.com>
To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>
Sent: Friday, September 26, 2008 5:53:47 PM
Subject: Re: [osg-users] Optimizer StateVisitor not working

HI Demi,

There are range of reasons why the visitor will deem some duplicate
state as not being appropriate for merging, so it could be one of
these mechinism rather than a bug that is preventing the merge.  For
instance it won't merge objects that have don't have a DataVariance
set to STATIC, and this may well be what is prevent the merge in your
case.

Try setting you objects DataVariance to STATIC and then do the
optimizer pass again.

Robert.

On Fri, Sep 26, 2008 at 2:52 PM, dimi christop <dimi_christop at yahoo.com> wrote:
> Hi,
> I am trying to find ways to optimize my scene by removing duplicate StateSets using the Optimizer.
> Unfortunately even though I could see inside the osg files (using an editor) duplicate StateSets nothing was shared.
> As an example the osg file below although consisting of 2 identical statesets, running the optimizer nothing is shared.
> You can simply see that that by just running the osgviewer with this file using the environment variables
> OSG_NOTIFY_LEVEL = INFO
> OSG_OPTIMIZER = SHARE_DUPLICATE_STATE
>
> osgviewer runs the optimizer by default. It prints out that 2 StateSet were found but none shared!
> It also spits out the stats before/after the optimization.
> Why ist that?
>
> Thanks
> Dimi
>
>
> MatrixTransform {
>  DataVariance STATIC
>  name "TestCube2.xsi"
>  nodeMask 0xffffffff
>  cullingActive TRUE
>  referenceFrame RELATIVE
>  Matrix {
>    1 0 0 0
>    0 -4.37114e-08 1 0
>    0 -1 -4.37114e-08 0
>    0 0 0 1
>  }
>  num_children 1
>  MatrixTransform {
>    name "MDL-cube"
>    nodeMask 0xffffffff
>    cullingActive TRUE
>    referenceFrame RELATIVE
>    Matrix {
>      1 0 0 0
>      0 1 0 0
>      0 0 1 0
>      0 0 0 1
>    }
>    num_children 1
>    Geode {
>      DataVariance STATIC
>      name "MSH-cube"
>      nodeMask 0xffffffff
>      cullingActive TRUE
>      num_drawables 2
>      Geometry {
>        DataVariance STATIC
>        StateSet {
>          DataVariance STATIC
>          rendering_hint DEFAULT_BIN
>          renderBinMode INHERIT
>          GL_CULL_FACE ON
>          GL_LIGHTING ON
>          GL_BLEND OFF
>          Material {
>            ColorMode OFF
>            ambientColor FRONT 0.5 0.5 0.5 1
>            ambientColor BACK  0.2 0.2 0.2 1
>            diffuseColor FRONT 1 1 1 1
>            diffuseColor BACK  0.8 0.8 0.8 1
>            specularColor FRONT 0 0 0 1
>            specularColor BACK  0 0 0 1
>            emissionColor FRONT 0 0 0 1
>            emissionColor BACK  0 0 0 1
>            shininess FRONT 0
>            shininess BACK  0
>          }
>          CullFace {
>            mode BACK
>          }
>          textureUnit 0 {
>            GL_TEXTURE_2D ON
>            Texture2D {
>              name "Priene-Stadio_Ground.rgb"
>              file "Priene-Stadio_Ground.rgb"
>              wrap_s REPEAT
>              wrap_t REPEAT
>              wrap_r CLAMP
>              min_filter LINEAR_MIPMAP_LINEAR
>              mag_filter LINEAR
>              maxAnisotropy 1
>              borderColor 0 0 0 0
>              borderWidth 0
>              useHardwareMipMapGeneration TRUE
>              unRefImageDataAfterApply TRUE
>              internalFormatMode USE_IMAGE_DATA_FORMAT
>              resizeNonPowerOfTwo TRUE
>            }
>          }
>        }
>        useDisplayList TRUE
>        useVertexBufferObjects FALSE
>        PrimitiveSets 3
>        {
>          DrawElementsUShort TRIANGLE_STRIP 4
>          {
>            1 2 0 3
>          }
>          DrawElementsUShort TRIANGLE_STRIP 4
>          {
>            7 4 6 5
>          }
>          DrawElementsUShort TRIANGLE_STRIP 4
>          {
>            9 10 8 11
>          }
>        }
>        VertexArray Vec3Array 12
>        {
>          -4 -4 -4
>          -4 4 -4
>          4 4 -4
>          4 -4 -4
>          -4 -4 -4
>          4 -4 -4
>          4 -4 4
>          -4 -4 4
>          -4 -4 4
>          4 -4 4
>          4 4 4
>          -4 4 4
>        }
>        NormalBinding PER_VERTEX
>        NormalArray Vec3Array 12
>        {
>          0 -0 -1
>          0 -0 -1
>          0 -0 -1
>          0 -0 -1
>          -0 -1 0
>          -0 -1 0
>          -0 -1 0
>          -0 -1 0
>          0 0 1
>          0 0 1
>          0 0 1
>          0 0 1
>        }
>        TexCoordArray 0 Vec2Array 12
>        {
>          0 0
>          0 1
>          1 1
>          1 0
>          0 0
>          1 0
>          1 0
>          0 0
>          0 0
>          1 0
>          1 1
>          0 1
>        }
>      }
>      Geometry {
>        DataVariance STATIC
>        StateSet {
>          DataVariance STATIC
>          rendering_hint DEFAULT_BIN
>          renderBinMode INHERIT
>          GL_CULL_FACE ON
>          GL_LIGHTING ON
>          GL_BLEND OFF
>          Material {
>            ColorMode OFF
>            ambientColor FRONT 0.5 0.5 0.5 1
>            ambientColor BACK  0.2 0.2 0.2 1
>            diffuseColor FRONT 1 1 1 1
>            diffuseColor BACK  0.8 0.8 0.8 1
>            specularColor FRONT 0 0 0 1
>            specularColor BACK  0 0 0 1
>            emissionColor FRONT 0 0 0 1
>            emissionColor BACK  0 0 0 1
>            shininess FRONT 0
>            shininess BACK  0
>          }
>          CullFace {
>            mode BACK
>          }
>          textureUnit 0 {
>            GL_TEXTURE_2D ON
>            Texture2D {
>              name "Priene-Stadio_Ground.rgb"
>              file "Priene-Stadio_Ground.rgb"
>              wrap_s REPEAT
>              wrap_t REPEAT
>              wrap_r CLAMP
>              min_filter LINEAR_MIPMAP_LINEAR
>              mag_filter LINEAR
>              maxAnisotropy 1
>              borderColor 0 0 0 0
>              borderWidth 0
>              useHardwareMipMapGeneration TRUE
>              unRefImageDataAfterApply TRUE
>              internalFormatMode USE_IMAGE_DATA_FORMAT
>              resizeNonPowerOfTwo TRUE
>            }
>          }
>        }
>        useDisplayList TRUE
>        useVertexBufferObjects FALSE
>        PrimitiveSets 3
>        {
>          DrawElementsUShort TRIANGLE_STRIP 4
>          {
>            1 2 0 3
>          }
>          DrawElementsUShort TRIANGLE_STRIP 4
>          {
>            7 4 6 5
>          }
>          DrawElementsUShort TRIANGLE_STRIP 4
>          {
>            9 10 8 11
>          }
>        }
>        VertexArray Vec3Array 12
>        {
>          -4 -4 -4
>          -4 -4 4
>          -4 4 4
>          -4 4 -4
>          4 -4 -4
>          4 4 -4
>          4 4 4
>          4 -4 4
>          -4 4 -4
>          -4 4 4
>          4 4 4
>          4 4 -4
>        }
>        NormalBinding PER_VERTEX
>        NormalArray Vec3Array 12
>        {
>          -1 0 -0
>          -1 0 -0
>          -1 0 -0
>          -1 0 -0
>          1 0 0
>          1 0 0
>          1 0 0
>          1 0 0
>          0 1 0
>          0 1 0
>          0 1 0
>          0 1 0
>        }
>        TexCoordArray 0 Vec2Array 12
>        {
>          1 0
>          0 0
>          0 1
>          1 1
>          1 0
>          1 1
>          0 1
>          0 0
>          1 1
>          0 1
>          0 1
>          1 1
>        }
>      }
>    }
>  }
> }
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



      



More information about the osg-users mailing list