Skip to main content

Command Palette

Search for a command to run...

What We Can Learn From Grass in Ghost of Tsushima Renders

Published
7 min read
What We Can Learn From Grass in Ghost of Tsushima Renders

Introduction

Ghost of Tsushima renders huge fields of grass that sway in the wind. Each blade animates on its own. Roughly 83,000 blades on screen at once. In about 2.5 milliseconds per frame.

This post is not about copying their exact code. It is about the core ideas behind how they did it. Principles you can steal and reuse whenever you need to render a lot of something.

Here's the original talk: Procedural Grass in Ghost of Tsushima.

The First Big Decision. No Grass Cards.

Most games use grass cards for grass. A grass card is a flat rectangle with a grass texture painted on it. Like a photo of grass taped to cardboard. You place thousands of these around the world.

Grass cards have two big problems.

One. The wind animation is stuck to the whole card. The whole card wiggles as one piece. Individual blades cannot sway independently. It looks fake up close.

Two. Overdraw. Overdraw is when the GPU paints the same pixel more than once in a frame. Cards overlap a lot. Most of each card is transparent. The GPU still has to process all those transparent pixels. Wasted work.

Sucker Punch threw cards out. Instead. They build each blade of grass from scratch using math. Every frame. On the GPU.

Principle One. Build It From Math. Not From Assets.

Each blade in Ghost of Tsushima is a cubic bezier curve. A cubic bezier curve is a math curve defined by 4 control points. You move those points. The curve changes shape.

  • Point 1. Base of the blade. Where it meets the ground.

  • Point 4. Tip of the blade.

  • Points 2 and 3. In the middle. They control how the blade bends.

Move the tip. The blade leans. Push the middle points up. The blade arches. That is it. Whole blade shape controlled by 4 positions.

Why this is a huge deal.

Cards are static. You made them once. You are stuck with them.

Bezier curves are live. You build the blade fresh every frame from 4 points. So.

  • Want the blade to sway. Move the tip a little.

  • Want the player to push it. Push a control point.

  • Want wind to curve it. Move the middle points.

  • Want 50 different blade shapes. Just change the point positions.

You are not animating a model. You are rebuilding the blade every frame with slightly different numbers.

Principle Two. The CPU Is the Bottleneck. Talk to the GPU Less.

Say you have 83,000 blades of grass. If the CPU tells the GPU "draw this blade" 83,000 separate times. The CPU dies. Not because drawing is slow. Because talking is slow.

Each instruction to the GPU is called a draw call. Draw calls are expensive on the CPU side. Setting up state. Sending data. Validation. All that overhead adds up fast.

The fix is GPU instancing. You tell the GPU once. "Draw this blade shape 83,000 times. Here is the list of positions. Go." One draw call. GPU handles the rest in parallel.

Wait. Is this not just parallelism.

No. GPUs are parallel by default. That is just what they do. The thing instancing fixes is different. It cuts down draw call overhead. The CPU saying the same thing 83,000 times vs saying it once.

Take away principle. When you have many copies of something. One mesh. Many positions. Instance it. Particles. Trees. Rocks. Crowds. Bullets. Tiles. All the same pattern.

Principle Three. Do Not Compute What You Cannot See.

Even with instancing. You do not want to render a million blades when only 83,000 are visible. That is 12x more work than needed.

Ghost of Tsushima throws blades away in stages. Before they ever reach the vertex shader.

  • Distance culling. Too far from the camera. Drop it.

  • Frustum culling. Outside what the camera can see. Drop it. The frustum is the pyramid shape of what the camera is looking at.

  • Occlusion culling. Hidden behind a hill or a wall. Drop it.

  • Type culling. This spot has no grass type assigned. Drop it.

  • Height culling. This spot has zero-height grass. Drop it.

Each stage is cheaper than the next. Cheap tests first. Expensive tests only on survivors. By the time you start actually building blades. You have the real working set.

Take away principle. Culling is layered. Cheap tests kill most of the work. Expensive tests only run on what survives. This pattern applies everywhere. Physics. AI. Rendering. Audio. Pathfinding.

Principle Four. Clumps. Controlled Randomness Beats Pure Randomness.

Their first grass looked boring. Like a golf course. They tried adding more randomness. It just looked messy. Not natural.

Real fields are not random. They are clumpy. This patch got more sunlight so the grass is taller here. That spot has different soil so the grass is darker there. The variation has structure.

To fake this. They use a voronoi algorithm. Voronoi means dividing space into regions around points. Each blade checks which clump point it is closest to. That clump controls the blade's height. Direction. Color. Bend.

So instead of each blade being random by itself. Blades in the same clump share traits. The field has patches of tall grass. Patches of short grass. Patches pointing slightly different directions. It looks alive.

Take away principle. Randomness alone looks fake. Structured variation looks real. If you need something to feel organic. Group it into clusters first. Then vary within and between clusters.

Principle Five. Two Levels of Detail. Far Stuff Gets Cheaper.

Close grass has 15 vertices per blade. Far grass has 7. That is less than half.

A vertex is a corner point on a piece of geometry. More vertices means smoother curves but more work. Far away you cannot see the difference. So use less.

Transitioning between the two is tricky. If you just snap from 15 to 7 verts. The blade shape pops. Visible. Ugly. So the high-detail version slowly blends toward the low-detail shape as it gets close to the transition distance. By the time the swap happens. Both versions look nearly identical. No pop.

Also. Far away tiles are twice as big but have the same number of blades. So far grass is spread out twice as far apart. To hide this. Near grass drops 3 out of every 4 blades as it gets close to the far distance. Thins out gradually. So when you cross the line. The density already matches.

Take away principle. Not everything deserves full detail. Pay for quality where the player will see it. Skimp where they will not. And always blend between detail levels. Never snap.

Principle Six. One Trick For Short Grass. Fold The Verts.

Here is a clever one. If the grass is short. The blade does not need all 15 vertices. A short blade looks fine with 7. So they reuse the other 8 vertices to build a second blade right next to the first one.

Same draw call. Same vertex budget. Twice the blades. Free density.

You only get this trick because the geometry is procedural. If you were using cards or premade meshes. You could not do this. The vertices are flexible. So you use them however is most useful.

Take away principle. When you have a fixed budget. Ask if you can split it. Sometimes the thing you are building does not need the whole budget. So the leftover becomes another thing.