Download

Grass in C++

I’ve been trying to create grass. My world is 100% dynamic meaning that nothing is created using the editor. Everything is programmatically spawned in C++ and I only use Blueprints when really necessary. Unfortunately, all I find about creating grass is made using the Landscape Mode of the editor by “painting” grass but I couldn’t find anything about creating grass entirely in C++.

How would this be done? I create ULandscapeGrassType, add a FGrassVeriety to it (a simple Plane mesh is enough?), play with its parameters and spawn the grass to my world … somehow! Anyone did this using only C++?

I believe grass is created using Hierarchical instanced static meshes.

If you can’t use landscapes at all, might be worth making your own grass system using the above, and spawning it where it needs to be.

Searching for “Hierarchical instanced static mesh” lead me to the page TileActor/ForestTileActor.cpp at master · hallatore/TileActor · GitHub that gave me great help. Thanks for pointing me to the right direction!