Grass Simulation
Project Description
Throughout late 2020 and 2021, I was heavily invested in a ARPG game called Genshin Impact. One thing that I found really beautiful was the grassy terrain that was present throughout the game so I became really inspired to recreate this effect and hence this project. Although I know that using geometry and tessellation shaders may not have been the best approach, I kind of wanted to have an excuse to learn them while having fun.
Technologies Used
Requirements
Simulating realistic grass poses several challenges:
- Performance: Rendering countless individual grass blades can quickly overwhelm even powerful GPUs.
- Detail: Capturing the intricate details of individual blades and their interactions with wind and light requires careful shader design.
- Flexibility: The solution should be adaptable to different terrains shapes.
Process
Tessellation Shader
The tessellation shader was used to dynamically subdivide my terrain mesh where each vertex is a seed for for a grass to grow from. Vertices that are far from the camera are culled to preserve performance.
Geometry Shader
The geometry shader then analyses each seed point and constructing individual grass blades based on parameters like height, density, and randomness. Furthermore this shader is responsible for interacting with the wind.
Results
The final result was a dynamic grass system that convincingly mimicked the look and feel of Genshin Impact's terrain. While it may not be the most performant solution, it provided a valuable learning experience and opened my eyes to the possibilities of tessellation and geometry shaders in Unity. There are many optimisations that could still be made but I think I have achieved what I set out to do and will stop it at here for now. Here are some of my results.