Feature Library

GPU meadow grass

1.44 GPU · 0.28 CPU ms
A still of the GPU meadow grass demo
Still
The live demo starts when it’s in view.Shift-drag across the grass to trample and wear it · drag to orbit · try Loose stones and Contact shade

Hundreds of thousands of curved blades decided on the GPU every frame.

What it costs a frame

1.44 ms
0.28 ms
GPU
1.44 ms
CPU, median
0.28 ms
CPU, 95th pct
0.41 ms
Draw calls
4
Compute passes
4
Weight
Moderate

Measured 3 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 156, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Balanced density over an 80 m square round the focus (the game’s default), the ball rolling, wind 1: one placement compute pass and three indirect draws. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool1.440.280.41
apple · Apple A19 Proin a browser tab · 16 November 20263.350.100.18
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 202620.80.901.78

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
WebGPU or WebGLWebGPU where there is one, WebGL2 where there is not.
Your browser
Runs hereNo WebGPU needed
Depends on
three.js 0.187.0No other packages

What it’s for

  1. Open-world fields and lawns
  2. Paths that characters and vehicles leave
  3. Wind you can see
  4. Stylised or realistic landscapes
  5. Hero shots of nature
  6. Worn paths across a lawn or a field
  7. No grass through crates, walls and posts
  8. Pebbles and gravel on paths, tracks and yards
  9. Grounding characters and props without a shadow map

Pitfalls, in brief

  1. Work a blade out once in compute (placement, culling, LOD list), not per vertex: the vertex shader only rebuilds the blade from its spot by hashing.
  2. Blades under a pixel wide cost far more to draw than wider ones and flicker as single bright pixels: widen them to a minimum on screen (setPixelsPerMetre) and fade short ones.
  3. Light blades by hand (sun + sky, a little light through the tips) instead of a PBR light loop: hundreds of thousands of fragments.
  4. The gusts’ pattern must travel by the wind summed frame by frame, not wind × clock: a change of wind would jump the whole pattern.
  5. Soft edges need the canvas’s MSAA (antialias: true) for alpha to coverage.
11 more in brief
  1. The density field is 192 cells a side (96 m at 0.5 m): the ground-under-grass texture is shared at that size, and the meadow checks it.
  2. Measure uncapped: at a frame cap the GPU drops its clocks and the timer swings by ±2 ms.
  3. Keep grass off fixed things by rasterising their footprints into the field, not by casting a ray down every cell: HaTac_FP’s ray bake was a 90 ms hitch while driving and up to 33 ms a mask; the footprints from above (a box’s eight corners as a hull, a round thing a circle) filled a span a row are about four times faster and give the same cells.
  4. Wear and trampling are different clocks: trampling bends grass for seconds (the layer’s recovery), wear thins it to earth over many passes and grows back over minutes.
  5. A new density is a 147 KB upload: make it a few times a second at most (WearField does, every 0.2 s), never every frame, and only while something changed.
  6. Draw every kind of loose stone in one indirect draw: put all pieces’ triangles in one storage pool padded to the longest (a padded triangle is three points at the origin and draws nothing), and let each row carry its piece above its turn (turn + piece × 8).
  7. Store nothing per stone: hash a spot’s cell for its jitter, piece, size, turn, tilt and tint, so a stone is where it was when the camera comes back.
  8. Draw loose stones larger than real (1.6–2.4 ×): at a game camera a 3 cm pebble is a pixel, and a shimmer of pixels reads as noise, not gravel.
  9. On an integrated GPU (an Intel Arc 140V draws the Balanced bench in about 21 ms, 14× the reference laptop) cut blades, not effects: the cost goes with (area ÷ spacing)², most of it the far ring of one-segment blades, so the game’s Mobile spacing and a shorter reach (MEADOW_TIERS.low: 0.12 m over 64 m) do more than anything else; then drop alpha to coverage and end the curved blades nearer (tier).
  10. A contact shade is see-through, writes no depth and is pulled toward the camera (polygon offset): set into the ground it fights it, and drawn with depth it hides what stands on it.
  11. Without WebGPU, set webgl: !meadowOnGpu(renderer) (and check meadowRunsOnWebGL: it needs float colour targets).
16 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From HaTac, and in the garden walk showcase. Fully custom code.

False Earth, “How we made the grass” (Codrops, 2026): The roadmap the meadow follows: blade shading, distance LOD, GPU placement and culling, curved blades. The write-up, not its code.

A. M. Andrew, “Another efficient algorithm for convex hulls in two dimensions” (1979): The monotone-chain hull a footprint’s outline is taken with (footprints.ts).

grasscomputeindirect drawlodwindtramplingalpha to coveragetslwearfootprintsbare groundloose stonesgravelscattercontact shadowblob shadowrender-target placementwebgl fallback

Near it in the frame