8000 trees and 2.5M blades of grass? No problem.

· by Steve · Read in about 3 min · (598 Words)

I’ve been crazily busy lately trying to get OgreSpeedTree to a fit state for a 1.0 release alongside other projects (such as Ogre of course), so I can really start promoting it. Being the kind of person I am, I find it hard to stop tinkering and perfecting and I can’t let something go out the door without being totally happy with it. The screenshots and videos so far have been good I think, but I’ve been polishing away and making it all just that bit better, and one element of that has been some additional optimisation.

Thanks to some improved batching, OgreSpeedTree is now running even faster than before, and most importantly it scales to larger forests even better than before too. Here’s a short video where I tested adding over 8,000 trees (from 5 different models, and each with different rotations / scales) to the scene, together with over 2.5 million blades of grass, each of which can  be placed individually (I procedurally generated the distribution, but it could be done manually). Actually some of those tree models have multiple trees in them (the very close ‘clusters’ of ¾ are actually one model), so in reality there are actually 12,000+ trees as far as the viewer is concerned.

Note that all the trees here are dynamically lit including normal mapping, and dynamic shadows are being cast through 3 shadow textures (PSSM). The LOD transitions are extremely hard to spot IMO too.

[I’ve been crazily busy lately trying to get OgreSpeedTree to a fit state for a 1.0 release alongside other projects (such as Ogre of course), so I can really start promoting it. Being the kind of person I am, I find it hard to stop tinkering and perfecting and I can’t let something go out the door without being totally happy with it. The screenshots and videos so far have been good I think, but I’ve been polishing away and making it all just that bit better, and one element of that has been some additional optimisation.

Thanks to some improved batching, OgreSpeedTree is now running even faster than before, and most importantly it scales to larger forests even better than before too. Here’s a short video where I tested adding over 8,000 trees (from 5 different models, and each with different rotations / scales) to the scene, together with over 2.5 million blades of grass, each of which can  be placed individually (I procedurally generated the distribution, but it could be done manually). Actually some of those tree models have multiple trees in them (the very close ‘clusters’ of ¾ are actually one model), so in reality there are actually 12,000+ trees as far as the viewer is concerned.

Note that all the trees here are dynamically lit including normal mapping, and dynamic shadows are being cast through 3 shadow textures (PSSM). The LOD transitions are extremely hard to spot IMO too.

](http://vimeo.com/1751960?pg=embed&sec=1751960)

On my 9800 GX2 with a 2.66 dual-core, it runs consistently over 60fps (actually about 75fps most of the time). This is with a quite dense  clustering of the trees too; If you spread the trees out a bit more you can easily double that. The LOD settings are quite high too; reign those in and your lower class cards should be able to easily handle this, and of course you have the option of dropping or scaling back the dynamic shadows if you’re pushed.

I’m happy 😀Not that I’ve quite finished of course, I have a couple of things still to polish for 1.0, but it shouldn’t be long now.