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.



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

Google will provide many shader driven approaches and other techniques.

  • \$\begingroup\$ I've also done this in the past using a Particle System to generate my grass quads. I disabled its animation so the grass wouldn't appear/vanish based on particle lifetime, basically using the system as a way to manage many billboarded textured quads efficiently. ;) \$\endgroup\$ – DMGregory Feb 15 '16 at 14:57

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.

The most simple way is to create your own planar mesh and apply a shader with back face OR use a reversed V pattern which are really close to each other where each side is the mirror of the opposite. Then place that manually one by one in your scene. The trick is to make sure it's both a static prefab as well as having it enabling GPU Instancing on the 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 is the one which manage what's where based on the priorities.)

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

The slightly more complex by WAY faster option is to use a particle (shuriken) system with a Mesh emitter with 0 gravity and force and with the setting 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" + "Prewarm" and by typing "Infinity" in the StartLifetime option. Ideally, you would have to have a script that could call the Stop() function so that the particle stop calculating generating, but keep the instantiated particles in the scene.

If everything have been set right, this would generate the grass with GPU instancing.

The cool thing about this possibility is that you can controls the particles 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 generate different multiple kinds of grass and flowers if you set it up right.

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

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

It is very simple, Create one pdf like a grass texture. Place it in your unity package and goto terrain settings in 6th tab you can find a button lime a grass select it. select edit Details -> Add Grass Testure -> Detail Texture. in detail texture select the pdf file you have been created. adjuse the brush size and opacity. click your terrain.

Please Click the link For more details:

  • \$\begingroup\$ As said in the question, it's not a unity terrain, it's just a mesh I constructed myself. \$\endgroup\$ – ElDuderino Nov 16 '15 at 11:59
  • \$\begingroup\$ you can't able to add normal grass in your own mesh. but if you create your own grass with animation means you can able place it manually it will work. \$\endgroup\$ – Manoj Balaji M Nov 17 '15 at 4:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.