# How to place grass on custom terrain mesh

I made a custom terrain mesh and textured it, now I want to place grass on it, but I don't know how. I only find info about grass with the unity terrain. I am not even sure what exactly to look for.

What is the best/easiest way to place grass on a terrain? I'd like to do it in the shader if possible, but I guess I will need additional geometry if I want it to "stick out"?

(Random example picture http://www.beamng.com/attachments/stuff-png.16516/)

I'd appreciate a general outline on how to tackle this problem and maybe some links for further reading.

Thanks.

This is an old topic, but it's still valid.

There are a couple of ways you can handle grass outside of Unity's Terrain System.

The simplest way is to create your own planar mesh and apply a shader with back faces or use a reversed V pattern which are really close to each other and where each side is the mirror of the opposite. Then place copies of those manually one by one in your scene. The trick is to make sure it's both a static prefab as well as having GPU Instancing enabled on its material. This will allow the grass to be either batched or having a single copy stored in the GPU and rendered with the lighting variation. (It's one or the other, but by enabling both, the engine will which manage what's where based on the priorities.)

The con of that option is that it's time consuming.

The slightly more complex but way faster option is to use a particle (shuriken) system with a Mesh emitter with 0 Gravity and Force and with Normal Offset set so that the grass appears on the mesh's surface. You can make the grass particle infinite by disabling the Over Lifetime module in the particle, activating Looping and Prewarm and typing Infinity in the StartLifetime option. Ideally, you would have to have a script that calls the Stop() function so the particle system stops calculating generation, but still keeps the instantiated particles in the scene.

If these instructions are followed, this will generate grass with GPU instancing.

The cool thing about this possibility is that you can control the particle's features like cast/receive shadows, the amount of grass generated, if the grass is affected by light probs and reflection probs or not, etc. It makes it easy to setup with advanced graphical options.

You can even setup a master shuriken particle system that will generate multiple kinds of grass and flowers.

The only con to this option is the lack of LOD if you have some really complex geometry for the mesh on which the grass texture appears. (It will apply Mipmaps if the textures have Mipmaps activated!) If you wonder, yeah it's possible to have the wind's force affect the particles... but that has to be done in the shader used for the particle.

• Hey thanks, I am working on other projects now, but will definitely try out the particle system setup. Sep 18 '18 at 8:17

You need to create a texture for your grass, then create the geometry that the texture will be rendered onto. Use each vertex in the terrain as a starting point for the origin where to render each instance of the grass geometry and using a pseudo random offset for each origin, you could render lots of grass fairly quickly