[osg-users] HeightField Performance

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Thu Nov 12 17:55:34 PST 2009

Hello Teodor,

> 1. Is this class the appropriate one for what I want to do?

I'm assuming you're using osg::HeightField with osg::ShapeDrawable - you 
didn't specify... Please try to be more precise in the future.

In that case, no, it's not appropriate for large height fields. As 
Robert has said many times in the past, anything using 
osg::ShapeDrawable with an osg::Shape is meant for debugging and 
quick-and-dirty tests, not for production use.

> 2. Are there other alternatives to it that would yield better performance

Whenever I've had to use height fields, I've always generated the 
geometry myself, it's pretty easy to do. You'll want to use triangle 
strips, and batch vertices together (experiment with different batch 
sizes per vertex array, for example 1000 or 10000 or 100000 per vertex 
array - different sized batches will be better on different generations 
of video cards).

There is osgTerrain::HeightFieldLayer, but I'm not sure how much better 
than osg::ShapeDrawable that is.

Perhaps others can suggest something else.

Hope this helps,

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list