Using the Geometry Shader In Unity To Generate Countless Of Grass On GPU

Jiadong Chen
The Programmer In Kiwiland
9 min readJul 16, 2020

--

This is an English translation of a blog I wrote in Chinese in 2017. Although the original blog was a few years ago, I found this article very interesting, so I decided to translate it into English.

You can find the Github Repo Link at the end of this Post.

When displaying a realistic rural scene in a game, the rendering of grass is essential, and when it comes to efficient rendering of grass, many people will think of Chapter 7 of GPU Gems, “Chapter 7. Rendering Countless Blades of Waving Grass” [1].

Now many mobile games are known as “next-generation” or even some PC games still adopt this solution more or less. However, this article will not discuss too much about this solution. Instead, most of the following content is about how to use the Geometry Shader to render countless grass on the GPU.

Grass Objects That Look Like Stars

In the traditional way, the model data is transferred from the CPU to the GPU, and then the GPU renders the grass objects based on the data. When rendering large-scale grass, the model details of a single grass are often ignored. If the model of a single grass is too detailed, rendering a large piece of grass needs to transfer a lot of vertexes, resulting in a decrease in…

--

--

Jiadong Chen
The Programmer In Kiwiland

Microsoft MVP, MCT | Azure Certified Solutions Architect & Cybersecurity Architect Expert | Member of .NET Foundation | Packt Author