This is part 1 of a multi-part series on grass rendering. We’ll start by figuring out how realistic grass should look like, and how herbage can be modeled with the tools we have at our disposal in real-time 3D graphics. Then, we’ll look at how to implement different methods of grass rendering in Godot. However, most of the tutorial will not be Godot-specific aside from some node names and syntax.
But before getting into any implementation details, we must first understand what grass even looks like.
What Does Grass Look Like?
Some of the visual properties are quite surprising if you have never really paid attention to them. For one, grass is shiny, especially long grass. Check out the specular hightlights in this example:
Although the random orientations of all the individual grass blades causes quite a rough appearance when looking at an entire field of grass - the specular highlights average out into a diffuse noise - the individual blades actually have quite strong specular reflections, and when looking at a field of grass against the sun, it is more shiny than you might intuitively think.
Secondly, grass is translucent. In fact, most herbage and foliage is quite translucent. In technical terms, translucency means that when the object is lit, it is also bright on the other side of its surface (although that light may look different, e.g. more diffuse and with a stronger color). This might seem obvious for grass, but it means we need to use an entirely different logic than what we usually do for rendering, since we usually assume that surfaces are hard and light does not go through them.
When looking at an entire field of grass, we see large patterns which affect multiple individual blades of grass that are next to one another. Grass is patchy: depending on environmental conditions, micro-relief, etc., patches of grass with different heights and different shades of green emerge.
Related to this patchiness, we see structure and detail mostly because grass is self-shadowing. The tips of grass are often brightly lit, especially those of larger stalks or tufts, whereas the bottom part is dark because it is occluded by all the surrounding grass. Similarly, we may be able to see some shadowing on the side of tufts when the sun is at a steeper angle.
How to Depict Grass in 3D Graphics?
Now we know what grass looks like, but we haven’t talked about a fundamental question when it comes to translating grass into 3D graphics: what kind of method would we even use to depict it?
Different games from different times have come to different conclusions here. In most older games, grass is simply textured onto the terrain:
This makes sense: when every vertex counts, you don’t want to add any vertices for something as insignificant as grass when you can just draw it onto the terrain. Even in modern games, this may be fine for very short grass, especially with techniques like bump mapping. However, tall grass will never look right with this method. This is why games have started adding actual objects for grass. There are two ways to do this:
Billboards render an image of multiple stalks of grass onto a plane. This is the oldest and still a very common, if not most common, way to depict grass. It takes just a few vertices and a texture to get a seemingly high-detailed tuft of grass. Here’s how grass looks in Horizon: Zero Dawn, along with the underlying geometry:
This method is great and, especially at a distance, sufficient for high realism. However, when grass is tall and very close by, the flatness of the billboards can start to become obvious. In addition, animating these billboards will never look like proper, individual grass blades moving in the wind. That is why some games use actual geometry for individual grass blades. This is easier in games with a cartoon art style, since grass blades can be quite tall and plainly colored there. Zelda: Breath of the Wild is a good example:
Probably the state-of-the-art of realistic (even if somewhat painterly) geometry-based grass is Ghost of Tsushima:
These games get a lot of their aesthetic from their grass, and only such games with full-geometry grass stalks can give you that feeling of being properly inside a field of tall grass.
Modern GPU hardware doesn’t care as much about the amount of vertices as older hardware did, so full-geometry grass is quite feasible nowadays. So in the next post, I will show how to create full-geometry grass in Godot; how to practically and efficiently fill a field with grass stalks, and how to shade them in a way that fulfills the criteria we set above: Grass Rendering Series Part 2: Full-Geometry Grass in Godot