Custom grass/plant meshes for Vegetation Studio

Custom grass/plant meshes for Vegetation Studio

In this small guide I will explain how to set up your custom grass and plant meshes with the Vegetation System grass Shader. This will allow you render your grass meshes using the instanced indirect implementation in Vegetation Studio and also use the TouchBend features.

You can also convert existing shaders to be used with instanced indirect, but that is another guide.

Material

In order to get started create a new material or change shader on your existing. The shader to select is AwesomeTechnologies/grass/grass. This shader can be used for plants and flowers also.

  • Assign the your albedo color texture to the material.
  • Assign a noise texture to the ColorNoise texture field. There is an included noise texture called PerlinSeamless in the VegetationStudio package. This noise is used to generate a color distribution on the terrain lerping from Color to Color B tint.
  • You can leave the rest of the settings to default as Vegetation Studio will configure most of them for you automatic.
  • The settings below are exposed to be configured in the UI of vegetation studio, but you can still set them on the material if you want a different default setting.

Wind and Root darkening

In order to get wind and root darkening on your vegetation meshes we need to have a bit of info in the mesh. This is done using the vertex colors on the mesh itself. This can be added in any mesh modeling tool that supports vertex painting or in code if you are generating the mesh

VertexColors

There is different info coded in each channel of the mesh.

R Channel/Root darkening

In the Red channel you can add a root darkening amount. This is used to create a vertex based ambient occlusion to the root of the grass.  Value goes from 0-1.  This is multiplied with the root ambient value on the shader for the final effect.

G Channel/Phase

In order to get better looking wind it is nice to have a phase value painted on the mesh. In the example image below each plane in the mesh has a different value (0-1) in the Green channel. This will make the individual grass strands move in different phase with the sinus based wind. It looks much better if all of the mesh does not move together.

The shown colors of the example image does not reflect the channel color you add info to

 

B Channel/Bend amount

The B channel of the vertex colors are the bend amount. for grass this is usually based on a curve or linear from bottom to top with the root vertices set to 0. This gives no movement. A higher value would make the root move on the ground and not look good.

The shown colors of the example image does not reflect the channel color you add info to

 

Add the finished prefab to Vegetation Studio as a Grass or Plant prefab and play. 🙂