[osg-users] automatically merge close-by geometries to reduce cull/draw overhead?

Robert Osfield robert.osfield at gmail.com
Mon Sep 7 03:32:31 PDT 2015


Hi Christian,

Since you are creating the building yourself I would recommend that you
build them grouped to start off with rather than post process them.

The first step I'd tack would be to create a texture atlas from the wall
and roof textures and then just create a single osg::Geometry and
associated osg::StateSet.   This will half the number of Drawables and
state changes.

If you have a set of roof and wall textures then see if you create a single
texture atlas from them so that you can then reuse the same osg::StateSet
between separate Drawables.

Then final step would be to merge groups of Drawables that are in
geographical location.  The osgforest example does grouping of randomly
placed trees so have a look at ways of doing this.

Another approach you could take would be to create a single osg::Geometry
and then use instances to repeat the building geometry and provide a size
for a shader to scale the geometry and place it in it's final position.
Again the osgforest has a code path that does this so have a look at this.

Robert.



On 7 September 2015 at 10:50, Christian Buchner <christian.buchner at gmail.com
> wrote:

> Hi,
>
> we're using code loading some buildings (outline and height), creating a
> Geode with a two drawables per individual building - one drawable for the
> walls, one for the roof polygon. This has served us well to display a few
> hundred to a few thousand buildings.
>
> Fast forward to current date. Our client has sent us a new geo data set
> containing 55000 building polygons. Once you zoom out the camera to show
> most of these buildings, frame rates drop into the low single digit, mostly
> due to all the culling effort done by the CPU (maybe also from the large
> number of draw calls). D'oh!
>
> Are there any specific features within OSG to group close by geodes, and
> to merge their drawables?
>
> I know the osgUtil::Optimize has flags for merging geodes and drawables,
> but I guess it would not automatically merge only very close objects.
>
> What path should I try to take for tackling this problem, if possible
> using built-in OSG features?
>
> Christian
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150907/0767a836/attachment-0003.htm>


More information about the osg-users mailing list