Hi,
I got some questions about the stategraph build by osg while
culltraversal.

So the primary question is: Why is the stategraph build from the root to
the leafs of the scenegraph and not the other way around?

To explain it a bit, lets make an example:

You want to display a model (a car for example), which is available as
.ive file. The model itself has a complex stateset with many
texturebinds. For each instance of the model in your scene you add a
transform node and a stateset which sets the material color. By doing so
you will loose the ability of osg to build a proper stategraph, the
stategraph becomes 'fragmented' because of setting the material color in
the parent stateset of the models graph.

The general problem is: In the scenegraph, the parameters of the
instances are in the inner nodes (the transform nodes). In the
stategraph, the parameters of the instances are at the leaf nodes.

Just consider another example: Lets assume you want upload
positions/rotations through uniforms to a shader. The statesets of the
uniforms have to be placed under the shader stateset to get the
stategraph sorting work properly.

I am currently working on integrating speedtree into osg. I converted
the shaders to glsl and the parameters to uniforms. The geometry is
setup like the examples of speedtree. It's all working pretty well, but
I am stuck with the problem above.

I'd like to organize the scenegraph as shown at the attached image
(please ignore the PositionAttitudeTransform, the position and rotations
are part of the stateset InstancesParms).

Basics of speedtree:
*four different shaders( in the example above are just three of them)
*3 levels of statesets:
        *first level: the shaders
        *second level: the 'template' parameters of the model (like
texture and material properties
        *third level: the instance parameters (like scale, position,
windoffset, rotation)

Now consider adding level of detail to the graph and try to organize the
graph like osg needs it: The shaders at the root, than the 'template'
stateset and than the instances. The result is that one has to clone the
whole LOD hierarchy for each shader which is not a desired solution.

I would prefer, if the stategraph is build from bottom up, instead of
top down.

Greetings,
Richard

<<attachment: best.png>>

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

Reply via email to