> > I think my data items are going to be per Geode (e.g., 
> thickness of a 
> > "part"), but I thought I still needed shader attributes instead of 
> > uniforms, because uniforms are per frame.  Unless you're 
> thinking I'd 
> > make an array of them where the indexing is the Geodes?
> 
> Nope, you can set uniforms in the state set of a 
> node/drawable. So each node/drawable can have a different 
> value for the same uniform (as long as you name all your 
> uniforms on each node with the same name). OSG will 
> automatically use the closest uniform in the current 
> Drawable's path up to the scene root as the current value of 
> the uniform with that name when rendering that drawable.
> 
> Attributes are only useful if you need per-vertex data. 
> Anything coarser than that and you're better off with uniforms.
>
Attributes provide a faster way of changing vertex properties even on a
per object basis, as it means all of your objects can share the same
state. Changing the value of uniforms cause the creation of a new state.
Lots of state changes can be very expensive.

At least it did last time I tried it.
Here is a reference from last year.
http://groups.google.com/group/osg-users/browse_thread/thread/3973790d19
c85823/6ef53c1c510aa821
 
I was dealing with a number of water effects ( splashes, water trails,
wakes ). For around 100 effects this change made a significant reduction
in CPU draw time, which was the bottleneck for my app. I was dealing
with a pretty low power CPU though.

Based on my experience of OSG, the performance recommendations I have to
give is that uniforms are to be changed between different classes of
objects ( no more than a handful per frame ). Anything more frequent
should probably be set as a vertex Attribute. See the osgforest example
for code on how you could achieve this.

I hope this is useful,

Colin.

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to