Grass Revisited

A problem with the earlier post on Meadows is that close-up the nature of the imposters becomes very evident and the scene lacks parallax. A different approach is to follow the folks from Outerra and look at their 2012 work on Procedural Grass Rendering.Although their approach is based on the use of a Geometry Shader which is unavailable to me (for sake of simplicity I’m still stuck in shader-model 3 and XNA 4 – which I hope to upgrade to SlimDX or a similar framework ‘real soon now’), the same effect can be generated using simple hardware instancing.

The key to this particular technique is that grass blades can be subject to a kind of Level of Detail (LOD) reduction for patches of grass that are progressively far away. Normally LOD schemes reduce models by removing individual vertexes and leaving a model that is less detailed, but still recognisable. Given that a grass blade is made up of around 7 vertexes, how do you implement a LOD scheme for it ?

The Outerra blog post makes the leap that it isn’t the grass blade itself that should be reduced but the number of grass blades, which would normally be both visible and obvious to the viewer. The brilliance of their scheme is to realise all you need to do to maintain a uniform appearance is to double the width of the grass blades each time your halve the number of them.

This trick really only works with grass (try doing it with a group of houses or trees) but its extremely effective.

GrassyLandscape

The full landscape above is made up of three incremental LOD levels, which are hard to spot in this capture. So the technique works.

A close-up of the finest level of detail (with medium and coarse LODs in the background). The apparent density of grass is unchanged but uses fewer and fewer vertexes as the view distance deepens.

ThinGrass

Then stripping away the fine LOD to see the medium LOD;

MediumGrass

and finally the coarse LOD.

ThickGrass

I’ve chosen to implement this technique using 3 fixed LOD meshes but you could get smoother results with more LOD meshes, with the downside being an increase in the number of render calls.

If you choose a more sympathetic texture for the ground, the blending of grass over a distance becomes much more effective as the grass blade colour segues into the ground colour naturally.

SympatheticGrassLandscape

GrassyValley