Lush, Wind-Blown Grass in Real-Time

SpeedGrass has become the go-to solution for grass covered terrains by developers using the SpeedTree SDK. The source code is made available to annual support customers for version 4.2, and comes standard with the SDK starting with version 5.0. Contact sales (see left panel) with further inquiries.

SpeedGrass Overview

SpeedGrass 640x480.mp4 | SpeedGrass 1024x768.mp4

Wind Effects

The rolling wind effect is handled by a single vertex shader which takes numerous inputs and parameters including wind direction, wind strength, global time, period scalar, amplitude scalar, LOD parameters, lighting parameters, and the camera’s position and direction. The figure below illustrates the basic rolling wind effect applied to the entire grass system (direction, strength, and period are all configurable and can be changed on the fly).

Local wind effects (local explosions or rotor wash from a nearby helicopter) are also possible and have been used at IDV but are not implemented in this initial version of SpeedGrass. If you're interested in these types of effects, drop us a line.

Level of Detail (LOD)

Because the grass is drawn at relatively high densities, culling and LOD play a large part in the rendering pipeline. A “circle” of grass follows the camera around the terrain, always showing an application-specified radius of grass from the center outwards. The grass fades away on the edges using an alpha test function. The fade radius is also user configurable.



The SpeedGrass LOD scheme is largely implemented in the vertex shader. The desired effect is to have a “ring” of grass around the camera at all times. Using an alpha test function, it gradually fades from 100% opacity to 0% opacity. The LOD parameters are set by the application and passed into the vertex shader. The figure below illustrates the LOD scheme employed. Grass beyond the fade ring is automatically culled by sub-regions.

 

Culling

Each instance of CSpeedGrassRT class controls a user-specified region grass. The region is internally broken into a set of sub-regions for more efficient culling. These sub-regions are automatically culled by SpeedGrass or can be setup to be culled by the application. While it is possible and almost always wise to rely on the games engine’s built-in culling algorithms, the SpeedGrass culling system allows culling using a far clipping plane much closer to the camera.

 

Grass Generation & Placement

SpeedGrass handles grass blade generation in a number of ways, facilitated by two 3ds max utility plug-ins and a set of utility classes and functions provided with SpeedGrass.

SpeedForest 3ds max plug-in

The SpeedForest 3ds max utility plug-in has a built-in file exporter designed specifically for placing large quantities of objects on terrain meshes. Rather than create a 3ds max object for each blade of grass (3ds max quickly becomes bogged down when dealing with high object counts), this exporter uses the SpeedForest tools to generate a file that contains the position and corresponding surface normal of every object generated by the forest generation algorithm (including terrain following, boundary shapes, and collision prevention).

CTerrain class

The CTerrain class houses the terrain geometry where the grass is to be generated. For any given (x,y) coordinate on the terrain (assuming a +Z up vector), CTerrain will return the interpolated normal, color, and z position at that point. In the case of overlapping terrains, multiple values will be returned.

Boundary utilities

Boundary shapes can be exported out of 3ds max and used in the program to control the placement of runtime generated grass. Classes and example code are provided for doing in-boundary generation very easily and efficiently.