Vulkan Grass Renderer
A million blades of grass, simulated and culled on the GPU
Vulkan, GLSL, C++ · Oct – Nov 2025
- 1M blades simulated every frame
- 4.31× faster with GPU culling at 1M blades
- 10 → 2 tessellation subdivisions, near to far
A real-time grass renderer in Vulkan, after Jahrmann and Wimmer's "Responsive Real-Time Grass Rendering for General 3D Scenes" (I3D 2017). Up to 2²⁰ blades, about a million, are simulated and culled in a compute pass every frame, then tessellated into geometry by the graphics pipeline.
A blade is a curve
Each blade is a quadratic Bézier curve, its three control points packed with its parameters into 64 bytes:
struct Blade {
vec4 v0; // base position, and orientation θ
vec4 v1; // Bézier guide point, and height
vec4 v2; // tip, moved by the forces, and width
vec4 up; // resting up direction, and stiffness
};
The forces move only the tip, v2. The guide point v1 follows from it, so the blade keeps a smooth curve.
Forces
- Gravity: the environment's pull, plus a quarter of it toward the blade's front,
gE + 0.25·|gE|·f, so blades droop forward instead of straight down. - Recovery: Hooke's law, back toward the upright tip,
(v0 + up·h − v2) · stiffness. Stiffness varies from 0.1 to 1.5 between blades, from floppy to stiff. - Wind: a direction and strength modulated by gusts, slow waves of
sinandcosacross the field that you can see roll over it, plus faster turbulence. It pushes hardest on blades it meets broadside, and on those still standing tall. - Validation: afterwards the tip is kept above the ground, the curve's length is held to the blade's height, and v1 is placed again so the curve stays smooth, whatever the forces did.


Culling
The same compute pass decides which blades get drawn. The survivors are appended to an output buffer through an atomic counter, and the count feeds an indirect draw, so the CPU never needs to know how many are left.
- Orientation: a blade seen edge-on is a sliver, and
|dot(θ, view)| > 0.9culls those within about 25° of edge-on. - View frustum: the base and the tip are projected to NDC, and a blade is culled only when both are outside the same plane, with 0.1 of tolerance so blades don't pop at the edges of the screen.
- Distance: beyond 50 units every blade goes. Nearer, the distance falls into 10 buckets that keep a shrinking share of the blades, from all of them to a tenth, picked by a hash of each blade's position, so the same blades stay from frame to frame and nothing flickers.
Tessellation
The tessellation control shader sets each blade's level of detail from its distance to the camera along the ground, falling off exponentially from 10 subdivisions close up to 2 far away. The evaluation shader walks the curve by de Casteljau's algorithm and offsets each point sideways by the blade's width, tapering to the tip, and the fragment shader lights a dark-to-light green gradient with Lambert.
Measuring it
An ImGui panel tunes every force and culling parameter live, sets the blade count on a power-of-two slider from 1 to 2²⁰, and shows the current, average and 1% low frame rates, with a frame-time graph. One button runs the benchmark: 8 blade counts × 5 culling setups, 40 configurations, each warmed up for 0.5 s and measured for 5, into a CSV named after the CPU and GPU it ran on.
| Blades | No culling | Orientation | Frustum | Distance | All three |
|---|---|---|---|---|---|
| 8,192 | 995.1 | 903.2 | 1,002.3 | 1,442.4 | 1,452.5 |
| 16,384 | 564.7 | 566.5 | 569.7 | 1,290.3 | 1,283.9 |
| 32,768 | 288.2 | 304.2 | 291.7 | 962.0 | 1,005.0 |
| 65,536 | 144.4 | 157.8 | 148.1 | 494.7 | 512.2 |
| 131,072 | 76.6 | 86.2 | 79.5 | 266.1 | 284.5 |
| 262,144 | 41.1 | 44.4 | 41.3 | 149.1 | 160.1 |
| 524,288 | 21.1 | 22.6 | 20.9 | 76.2 | 82.3 |
| 1,048,576 | 10.7 | 11.6 | 10.6 | 42.7 | 46.2 |
Distance culling does nearly all the work. From a fixed overhead camera few blades are edge-on or off-screen, so orientation and frustum culling cost about what they save; orientation culling even makes the smallest field 9% slower. Below about 32K blades the frame is bound by the CPU and the driver, and above about 262K, by compute.