Re: [osg-users] Color array optimization

2010-04-08 Thread Robert Osfield
HI Martin,

On Wed, Apr 7, 2010 at 9:27 PM, Martin Beckett m...@mgbeckett.com wrote:
 Don't know if it applies to OSG, but a common speedup with OpenGL used to be 
 to sort by vertex color so you draw all the vertex of the same color at once.

Was this in the glBegin/glEnd days?

 That might be out of date with modern cards and VBOs but shouldn't be too 
 difficult to implement.

With modern cards they just send all the vertex attributes required in
the vertex shader into the shader so it won't make a difference
whether the colour values change or not.

A small possible benefit might be gained If you did sort by colour and
the batches of the same colour were long enough to justify using a
single glColor instead of a color array per batch.   This would save
on memory and bandwidth, but if you made the batching too small then
the cost of too many small batches would outweigh this completely and
you'd end up with worse performance.   I would only expect a
performance benefit if the batches could be kept to over a thousand
vertices or so - i.e. you had continous blocks of same colour in a
array that you can group together.

This sorting isn't just something that could be done for colour, but
for all vertex attributes save for the vertex array, however, the same
batching granularity issues apply, if you can't keep the batches very
large then it's counterproductive.

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


Re: [osg-users] Color array optimization

2010-04-07 Thread Martin Beckett
Don't know if it applies to OSG, but a common speedup with OpenGL used to be to 
sort by vertex color so you draw all the vertex of the same color at once.

That might be out of date with modern cards and VBOs but shouldn't be too 
difficult to implement.

Martin

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=26534#26534





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


[osg-users] Color array optimization

2010-04-06 Thread Vincent Bourdier

Hi all,

Looking for optimization I'm currently searching a color Array 
optimizer. Something modifying the color array and its binding when 
possible, of course without modifying the render of the geometry.


Is there something like that ? I didn't found anything in the 
osgUtil::optimizer documentation.


Thanks.

Regards,
   Vincent.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Color array optimization

2010-04-06 Thread Robert Osfield
Hi Vincent,

On Tue, Apr 6, 2010 at 8:31 AM, Vincent Bourdier
vincent.bourd...@gmail.com wrote:
 Looking for optimization I'm currently searching a color Array optimizer.
 Something modifying the color array and its binding when possible, of course
 without modifying the render of the geometry.

 Is there something like that ? I didn't found anything in the
 osgUtil::optimizer documentation.

There isn't a specific color array optimization.   I'm rather curious
about what you'd optimize about a colour array.

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