[osg-users] binding a shader uniform to a matrix transform node

Botorabi botorabi at gmx.net
Tue Jul 15 11:01:50 PDT 2008


hi,

i am trying to setup a couple of meshes which should share the same geodes (vegetation meshes). the only difference between the meshes of same type is the transformation and a height bias which is used by a vertex shader program.

the height bias is defined as an uniform in the vertex program. i cannot set the uniform in the geometry's state set as the height bias must be set for every mesh individually. so i tried to set the uniform in the matrix transform nodes which contains the geodes. however it seems that the value of the uniform does not arrive with right value in the vertex shader. if the uniform is set in geodes' stateset the value is ok, though.

now my question: may i try another approach? is something wrong with setting an uniform ina matrix transform node?

thanks for any help
boto


p.s.: here is a snippet of the osg file:

....
      MatrixTransform {
        DataVariance STATIC
        name "Plane3505"
        nodeMask 0x5
        cullingActive TRUE
        StateSet {
          rendering_hint DEFAULT_BIN
          renderBinMode INHERIT
          Uniform {
            name "heightbias"
            type float 1 FloatArray 1
            {
              62.8316 
            }
          }
        }
        referenceFrame RELATIVE
        Matrix {
          0.5 0 0 0
          0 0.5 0 0
          0 0 0.5 0
          -0.0344534 0.0439845 -0.674881 1
        }
        num_children 1
        Geode {
          UniqueID Geode_12
          DataVariance STATIC
          nodeMask 0x5
          cullingActive TRUE
          num_drawables 1
          Geometry {
....




More information about the osg-users mailing list