Grass shader experiment

 from Red Blob Games
24 Feb 2021

I wanted to try drawing grass with shaders.

(error — see browser console)

The idea is to construct 30,000 blades of grass and then have them positioned with the vertex shader to respond to the player’s helicopter. The grass should all face away from the helicopter blades. But away from the helicopter they should point “upwards”, maybe modulated by noise. And to make it look visually upwards, I want to use an oblique projection like I did in mapgen4.


  1. Make a “blade of grass” geometry as an instance.
  2. Make one position and noise value per instance.
  3. Make the vertex shader position the grass.
  4. Make the vertex shader take the helicopter position into account.

I made the fragment shader vary the color on the blades so that it doesn’t look like a solid sea of green.

Email me , or tweet @redblobgames, or comment: