Hi Brian,

setLODScale is just a way to tweak the normal level of detail switching: 
switch earlier or later by a given factor.

I find the easiest to switch between models based on their screen size by 
setting:
         RangeMode PIXEL_SIZE_ON_SCREEN

For example less details if the model size is smaller than 10 pixels.

I attach a minimal example: as small house. When the house is smaller than 
200px, the chimney is not rendered. You can look at it in osgviewer. You can 
also change the LODScale within osgviewer by pressing '/' and '*' (10 % 
steps).

Hope this helps,
   Hans

On Saturday 12 April 2008 06:44:13 Brian wrote:
> Hi Gordon
>
> Thanks for that explanation.  I've got a few other questions if you don't
> mind.
>
> First, the parameter passed to the setLODScale function is called bias and
> is a float.  Based on the example you gave with three LODs, would the
> parameter passed to this function be 3?  Also, I see that both the
> SceneView and Camera classes are derived from CullSettings.  Should I be
> calling the SceneView's setLODScale or the Camera's?  I also see that there
> are references to the CullSettings in the CullStack and CullVisitor, and
> even further references in classes such as osgSim and osgTerrain.  I guess
> what I'm trying to do is to figure out which object's setLODScale should be
> called and what parameter to pass to it.
>
> Second, using your example again, are the three ranges for the LOD stored
> in the model file itself?  Do you happen to know, or could you point me to,
> the OSG format for these parameters?
>
> And finally, our modeling department is rather swamped at present.  Are
> there any tools (free tools are always good) or algorithms that I could use
> to decrease the polygon count in a model without compromising texture
> coordinates or general quality?  I've seen some polygon reducing algorithms
> that totally destroyed the model in terms of correct texturing.
>
> Thanks,
> Brian
>
>
>
> ----- Original Message -----
> From: "Gordon Tomlinson" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; "'OpenSceneGraph Users'"
> <osg-users@lists.openscenegraph.org>
> Sent: Friday, April 11, 2008 10:48 PM
> Subject: RE: [osg-users] setLODScale
>
>
> Hi Brian
>
> LOD = 'Level of Detail' and this could help you yes but .......
>
> SetLodScale is not much use to you if your SceneGraph/models does not
> contain LOD nodes, the scale just allows you to alter when the LOD node
> would swap to one of its children, Modelers such as Remo3d, Geo Pro,
> Multigen Creator (trivia fact Multigen hold half the patent on LOD)
>
> Basically you would create a model in your chosen modeler say with 3 levels
> of detail ( this number could be more or less )
>
> Level 1 Hi-res 5000 polys
> Level 2 Medium-res 2000 polys
> Level 3 Low Res 200 polys
>
>
> Then you would give these distance ranges when they should be visible
>
> Level 1 visible when the model is between 0 and 200 db units from your eye
> point
> Level 2 visible when the model is between 200 and 2000 db units from your
> eye point
> Level 3 visible when the model is between 2000 and 5000 db units from your
> eye point
>
>
> SetLodScale allows you to scale this switch-in switch out distances rather
> than having to change them by hand, as in a complicated scene you could
> have 100's-1000's of load nodes
>
> The LOD node can also be additive, rather than having only one node visible
> you could have say a tank body, then a turret then all the guns and bits
> and pieces
>
>
> So LODs would help but you need to have them in your models  etc..
>
> Quick and very dirty overview of LOD's , a Google etc should get you more
> detailed explanations etc
>
>
> See http://www.vis-sim.com/creator/models/diversion_left.zip for a simple
> Open flight file with 3 levels of LOD
>
>
>
>
> __________________________________________________________
> Gordon Tomlinson
>
> Email : [EMAIL PROTECTED]
> YIM/AIM : gordon3dBrit
> MSN IM : [EMAIL PROTECTED]
> Website : www.vis-sim.com www.gordontomlinson.com
> __________________________________________________________
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Brian
> Sent: Friday, April 11, 2008 9:23 PM
> To: osg-users@lists.openscenegraph.org
> Subject: [osg-users] setLODScale
>
>
> Hi,
>
> I have a rather large database with several models that I feel are the
> culprit of a rather slow FPS that I'm experiencing.  I've been looking
> around the header files and came across setLODScale.  The name of the
> function looks promising, but doing a search on OSG's site produced only a
> couple of hits with regard to fixes/additions to OSG.
>
> What is the primary purpose of this function?  Do my models and database
> need any special features to support it?  Is there some place on the OSG
> site where I can find information about it?
>
> Many thanks,
> Brian
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
LOD {
  DataVariance DYNAMIC
  name "lod2"
  nodeMask 0xffffffff
  cullingActive TRUE
  Radius -1
  RangeMode PIXEL_SIZE_ON_SCREEN
  RangeList 2 {
    0 200
    200 10000
  }
  num_children 2
  Geode {
    nodeMask 0xffffffff
    cullingActive TRUE
    StateSet {
      DataVariance STATIC
      rendering_hint DEFAULT_BIN
      renderBinMode INHERIT
      GL_CULL_FACE ON
      GL_LIGHTING ON
      Material {
        name "DefaultWhite"
        ColorMode DIFFUSE
        ambientColor 1 1 1 1
        diffuseColor 1 1 1 1
        specularColor 0.5 0.5 0.5 1
        emissionColor 0 0 0 1
        shininess 64
      }
      CullFace {
        mode BACK
      }
      ShadeModel {
        mode FLAT
      }
    }
    num_drawables 1
    Geometry {
      DataVariance STATIC
      useDisplayList TRUE
      useVertexBufferObjects FALSE
      PrimitiveSets 2
      {
        DrawArrays TRIANGLES 0 6
        DrawArrays QUADS 6 24
      }
      VertexArray Vec3Array 30
      {
        5.58902 3.85677 0.835589
        7.58902 3.85677 0.835589
        6.58902 4.98083 0.835589
        7.58902 3.85677 -1.16441
        5.58902 3.85677 -1.16441
        6.58902 4.98083 -1.16441
        7.58902 3.85677 -1.16441
        7.58902 1.85677 -1.16441
        5.58902 1.85677 -1.16441
        5.58902 3.85677 -1.16441
        7.58902 3.85677 0.835589
        5.58902 3.85677 0.835589
        5.58902 1.85677 0.835589
        7.58902 1.85677 0.835589
        7.58902 3.85677 -1.16441
        7.58902 3.85677 0.835589
        7.58902 1.85677 0.835589
        7.58902 1.85677 -1.16441
        5.58902 1.85677 -1.16441
        5.58902 1.85677 0.835589
        5.58902 3.85677 0.835589
        5.58902 3.85677 -1.16441
        5.58902 3.85677 -1.16441
        5.58902 3.85677 0.835589
        6.58902 4.98083 0.835589
        6.58902 4.98083 -1.16441
        7.58902 3.85677 0.835589
        7.58902 3.85677 -1.16441
        6.58902 4.98083 -1.16441
        6.58902 4.98083 0.835589
      }
      NormalBinding PER_VERTEX
      NormalArray Vec3Array 30
      {
        0 0 1
        0 0 1
        0 0 1
        0 0 -1
        0 0 -1
        0 0 -1
        0 0 -1
        0 0 -1
        0 0 -1
        0 0 -1
        0 0 1
        0 0 1
        0 0 1
        0 0 1
        1 -2.38419e-07 2.38418e-07
        1 -2.38419e-07 2.38418e-07
        1 -2.38419e-07 2.38418e-07
        1 -2.38419e-07 2.38418e-07
        -1 2.38419e-07 -2.38418e-07
        -1 2.38419e-07 -2.38418e-07
        -1 2.38419e-07 -2.38418e-07
        -1 2.38419e-07 -2.38418e-07
        -0.747135 0.664672 0
        -0.747135 0.664672 0
        -0.747135 0.664672 0
        -0.747135 0.664672 0
        0.747135 0.664672 1.5847e-07
        0.747135 0.664672 1.5847e-07
        0.747135 0.664672 1.5847e-07
        0.747135 0.664672 1.5847e-07
      }
      ColorBinding OVERALL
      ColorArray Vec4Array 1
      {
        1 1 1 1
      }
    }
  }
  Group {
    name "huisje2.ac"
    nodeMask 0xffffffff
    cullingActive TRUE
    num_children 2
    Geode {
      nodeMask 0xffffffff
      cullingActive TRUE
      StateSet {
        DataVariance STATIC
        rendering_hint TRANSPARENT_BIN
        renderBinMode USE
        binNumber 10
        binName DepthSortedBin
        GL_CULL_FACE ON
        GL_LIGHTING ON
        Material {
          UniqueID Material_0
          name "DefaultWhite"
          ColorMode DIFFUSE
          ambientColor 1 1 1 1
          diffuseColor 1 1 1 1
          specularColor 0.5 0.5 0.5 1
          emissionColor 0 0 0 1
          shininess 64
        }
        CullFace {
          mode BACK
        }
        ShadeModel {
          mode FLAT
        }
      }
      num_drawables 1
      Geometry {
        DataVariance STATIC
        useDisplayList TRUE
        useVertexBufferObjects FALSE
        PrimitiveSets 2
        {
          DrawArrays TRIANGLES 0 6
          DrawArrays QUADS 6 24
        }
        VertexArray Vec3Array 30
        {
          5.58902 3.85677 0.835589
          7.58902 3.85677 0.835589
          6.58902 4.98083 0.835589
          7.58902 3.85677 -1.16441
          5.58902 3.85677 -1.16441
          6.58902 4.98083 -1.16441
          7.58902 3.85677 -1.16441
          7.58902 1.85677 -1.16441
          5.58902 1.85677 -1.16441
          5.58902 3.85677 -1.16441
          7.58902 3.85677 0.835589
          5.58902 3.85677 0.835589
          5.58902 1.85677 0.835589
          7.58902 1.85677 0.835589
          7.58902 3.85677 -1.16441
          7.58902 3.85677 0.835589
          7.58902 1.85677 0.835589
          7.58902 1.85677 -1.16441
          5.58902 1.85677 -1.16441
          5.58902 1.85677 0.835589
          5.58902 3.85677 0.835589
          5.58902 3.85677 -1.16441
          5.58902 3.85677 -1.16441
          5.58902 3.85677 0.835589
          6.58902 4.98083 0.835589
          6.58902 4.98083 -1.16441
          7.58902 3.85677 0.835589
          7.58902 3.85677 -1.16441
          6.58902 4.98083 -1.16441
          6.58902 4.98083 0.835589
        }
        NormalBinding PER_VERTEX
        NormalArray Vec3Array 30
        {
          0 0 1
          0 0 1
          0 0 1
          0 0 -1
          0 0 -1
          0 0 -1
          0 0 -1
          0 0 -1
          0 0 -1
          0 0 -1
          0 0 1
          0 0 1
          0 0 1
          0 0 1
          1 -2.38419e-07 2.38418e-07
          1 -2.38419e-07 2.38418e-07
          1 -2.38419e-07 2.38418e-07
          1 -2.38419e-07 2.38418e-07
          -1 2.38419e-07 -2.38418e-07
          -1 2.38419e-07 -2.38418e-07
          -1 2.38419e-07 -2.38418e-07
          -1 2.38419e-07 -2.38418e-07
          -0.747135 0.664672 0
          -0.747135 0.664672 0
          -0.747135 0.664672 0
          -0.747135 0.664672 0
          0.747135 0.664672 1.5847e-07
          0.747135 0.664672 1.5847e-07
          0.747135 0.664672 1.5847e-07
          0.747135 0.664672 1.5847e-07
        }
        ColorBinding OVERALL
        ColorArray UniqueID Vec4Array_1 Vec4Array 1
        {
          1 1 1 1
        }
      }
    }
    Geode {
      nodeMask 0xffffffff
      cullingActive TRUE
      StateSet {
        DataVariance STATIC
        rendering_hint DEFAULT_BIN
        renderBinMode INHERIT
        GL_CULL_FACE OFF
        GL_LIGHTING ON
        Use Material_0
        ShadeModel {
          mode FLAT
        }
      }
      num_drawables 1
      Geometry {
        DataVariance STATIC
        useDisplayList TRUE
        useVertexBufferObjects FALSE
        PrimitiveSets 1
        {
          DrawArrays QUADS 0 24
        }
        VertexArray Vec3Array 24
        {
          7.34453 5.1005 -0.264852
          7.34453 4.1105 -0.264852
          7.01453 4.1105 -0.264852
          7.01453 5.1005 -0.264852
          7.34453 5.1005 0.065148
          7.01453 5.1005 0.065148
          7.01453 4.1105 0.065148
          7.34453 4.1105 0.065148
          7.34453 5.1005 -0.264852
          7.34453 5.1005 0.065148
          7.34453 4.1105 0.065148
          7.34453 4.1105 -0.264852
          7.34453 4.1105 -0.264852
          7.34453 4.1105 0.065148
          7.01453 4.1105 0.065148
          7.01453 4.1105 -0.264852
          7.01453 4.1105 -0.264852
          7.01453 4.1105 0.065148
          7.01453 5.1005 0.065148
          7.01453 5.1005 -0.264852
          7.34453 5.1005 0.065148
          7.34453 5.1005 -0.264852
          7.01453 5.1005 -0.264852
          7.01453 5.1005 0.065148
        }
        NormalBinding PER_VERTEX
        NormalArray Vec3Array 24
        {
          0 0 -1
          0 0 -1
          0 0 -1
          0 0 -1
          0 0 1
          0 0 1
          0 0 1
          0 0 1
          1 0 0
          1 0 0
          1 0 0
          1 0 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 0
        }
        ColorBinding OVERALL
        ColorArray Use Vec4Array_1
      }
    }
  }
}
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to