How to optimize custom grass?


I have made a procedural terrain generator, the problem is, I tried adding grass the easy way, e.g. texture on a plane is being spawned at a vertex, however, even with that little (compared to what you usually achieve with built-in terrain) amount I got a significant FPS drop, so how would I add vegetation? Or there is no easy way?

Well, first, use the quad instead of the plane. It uses like 1/64th as many polys.

But there are, in fact, dozens of ways… however, each have their benefits and drawbacks. I’ll list a few I can think of off the top of my head below, but I’m sure there are more comprehensive lists/guides to be found elsewhere online:

1.) Static Batching - basically cram as many grass quads as you can into a single mesh, but that eliminates billboarding
2.) Point Extrusion - define a mesh of points, then use the geometry shader to convert into billboarded quads
3.) Height mapping - similar to #2, but use one repeating flat mesh ‘tile’ and pass a heightmap to make sure the same mesh can fit itself to any terrain.

Keep in mind, you’re also not limited to one method. You can switch methods per LOD to make more expansive grass run well.