GPU Grass

GPU Grass is a replacement for Unity's terrain detail system. This tool provides a way to place grass and other objects onto terrain and render them in a very fast way.


The demo scene and all assets shown in the screenshots are included.


Documentation



Performance


GPU Grass uses very little CPU. In the demo scene on my machine GPU Grass takes 0.05ms during update and 0.021ms during late update. There are no hitches as you move around or when new grass comes into view. Everything is calculated every frame on the GPU. Because of this there are never any spikes or variances in the performance.



Features


  • Very little cpu usage. Almost everything is done on the GPU. The demo scene takes less than 0.05ms cpu on my machine.
  • No hitches. CPU and GPU usage is steady. There are no hitches when new things come into view.
  • LOD system.
    • 1 - 3 lod levels.
    • Vertex or pixel lit per LOD level. Objects up close can be rendered pixel lit and distant objects vertex lit.
    • Shadow settings per LOD level.
    • Dithering. LODs fade into each other and fade out at max draw distance.
  • Procedural placement of objects on terrain based on masks.
    • Custom texture mask.
    • Slope of terrain.
    • Height of terrain.
    • Terrain layer.
  • Multiple terrains. Each GPU Grass manager can render objects on multiple terrains with the same settings.
  • Wind.
  • Max draw distance per object and LOD.
  • Align to ground. Objects can be aligned to the terrain. Unlike most grass solutions GPU Grass does not rotate the objects but instead movies their verts up or down keeping them straight. For example grass on a slope will not be rotated.
  • View bending. Objects can be bent away from camera. Great for top down games for first person games where the player can look down.
  • Thin over distance. Instead of culling objects at max draw distance they can be thinned out based on distance. For example grass close to the camera can be very thick but thinner in the distance.
  • Placement based on random or blue noise. Blue noise can be used to place objects randomly but evenly spaced which is best for grass.
  • Color and scale based on masks.
  • Blend bottom of objects with the color of the terrain.
  • Independant XZ and Y scale of objects.
  • Terrain Holes.


Limitations


These features may be added in the future.


  • Hand or brush placement of objects. Placement of objects currently can only be done procedurally.
  • Occlusion culling. GPU Grass does frustum culling only. Occlusion culling may be added in the future. Also current culling does not take shadows into account but this may also be added in the future.
  • Shader Limitations. A single shader is provided with features that can be turned on and off. This shader is optimized for speed over quality.
    • Normal maps are not supported.
    • PBR shading.
  • Intersecting objects. If you have multiple types of objects they may be placed on top of each other.
  • Biomes. GPU Grass manager cannot blend between settings.
  • Billboards.
  • Transparency. Opaque or alpha test only.
  • Editor undo.
  • Save settings while in play mode.
  • Non random rotation. Objects are randomly rotated around y. X and Z rotations are 0.

These are features that GPU Grass cannot do.


  • Collision. Because everyting happens on the GPU based on masks collision cannot be generated for objects rendered with GPU Grass. The CPU does not know the position of size of objects.
  • Shader graph. Unity's shader graph does not currently support shaders that use instancing.


See Documentation for more details.