GPU Grass Renderer – Real-Time 3D Grass Rendering WIP
The GPU Grass Renderer is a real-time vegetation rendering system that generates, animates, and renders thousands of 3D grass meshes directly on the GPU. Unlike traditional billboard approaches, this version uses real geometry for each grass clump, allowing close-up detail and realistic interaction with lighting.
The renderer divides the terrain into GPU-driven chunks, each processed independently by compute shaders. These shaders sample height and splat maps to place instances procedurally across the surface. Each grass mesh is then drawn using indirect instancing, ensuring minimal CPU overhead even with millions of blades rendered simultaneously.
Key Technical Features:
- Procedural grass placement via GPU compute shaders.
- 3D grass meshes rendered using DrawMeshInstancedIndirect.
- Chunk-based generation and GPU bounds for efficient culling.
- Sampling from terrain heightmaps and splatmaps for accurate placement.
- Procedural wind animation and per-instance randomization in the vertex shader. TODO
- Full GPU pipeline: no CPU-driven instancing or per-frame mesh updates.
Technical Showcase
Full GPU Model-Based Grass Renderer
Thousands of real 3D grass meshes rendered fully on the GPU, distributed across terrain chunks.
Chunk-Based Distribution
Each terrain section is a GPU-generated chunk, enabling spatial culling and efficient streaming.
Compute Shader Placement
Procedural generation of grass positions based on height and splat maps, computed entirely on the GPU.
Procedural Wind Animation
Per-instance vertex deformation simulating wind sway, using trigonometric motion and noise variation.
What I Learned:
- Integration of compute shaders with Unity’s graphics pipeline.
- Efficient indirect instancing and draw call batching.
- Handling terrain-based data entirely on GPU memory.
- Balancing realism and performance for large-scale procedural rendering.
