top of page

There is a template scene for terrain environment in the asset package (both built-in and URP) located here:

17.PNG

If you want to create your own terrain and implement the grass shader here's the important steps to follow (youtube video at the end):

1. Setup the terrain

01terrain.png

Create a new terrain with a 50x50 dimension (works best out of the box rather than the HUGE 1000x1000 default terrain)

Then add the "BFGrassTerrain01" material or its URP equivalent or your own "Interactive Grass Terrain"-shader material

02terrain.png

IMPORTANT: You need to add the "BF_Terrain" script to your terrain for it to work properly and if you're only using the terrain feature of the grass shader without regards for other terrain assets compatibility you are not required to add a "terrainToCopy" parameter nor should you press the "Sync terrain Data" button

VERY IMPORTANT: Be extra careful with these fields, if you assign or press the sync terrain button on a terrain you do not want to change its previous height map it will override and change it, you can press the revert button to set the values back to how they were.

After you've set the right shader/material to your terrain get over the paint terrain tool in the terrain inspector:

18.PNG

2. Edit terrain layers

To draw ground on the terrain use the "Ground" NewLayer01, the position in the terrain layers arrangement is very important, the first one SHOULD ALWAYS be the ground layer.

To draw grass on the terrain use the other 7 "Grass" layers, if you don't want/need other grass layers you can delete them via the "Edit Terrain Layers" button (5+ layers takes way more performance than 4-).

If you want to edit the layers to have custom grass/ground you should head over to the corresponding "NewLayerXX" in the asset project:

03Terrain.png

The first layer which should ALWAYS be the ground layer and only needs a ground diffuse texture to work, you can change "Specular" color to change the overall color of the ground.

If you want to have a Ground Layer:

diffuse is the Ground Texture,

normal map should not be used,

specular color is the overall color of the ground,

Metalic should be set to 1,

Size.X is the Tiling size,

Size.Y is the grass thinness intersection

If you want to have a Grass Layer:

diffuse is the Grass Pattern,

normal map is the color,

specular color is the overall color of the grass,

Metalic should be set to 0,

Size.X is the Tiling size,

Size.Y is the grass thinness

The only difference between a Ground Layer and a Grass Layer is Metallic slider and Normal Map

Do not change the Tiling Offset from 1, this is used behind the scene for something else.

There is a Biplanar feature inside the terrain material properties that you can use to automatically draw ground on slope:

21.PNG

3. Biplanar Feature (optional)

If you want to change the texture tiling of your terrain, please do not use the tiling and offset of the grass material:

Untitled-3.png

Instead you should use the Size.X of the terrain layer tilling settings, so you can set the tiling for each individual texture!

Untitled-1.png

STOP there if you don't use any other terrain assets and are not looking for cross-compatibility!

4. Terrain Asset compatibility (optional)

My grass shader when implemented as a terrain should be considered as its own terrain shader/asset unlike grass billboards or textures. It is a complete solution that I keep expanding on.

Keeping that in mind I have implemented a solution for users to use my grass shader with ANY other terrain assets out there.

Here is what you need to do in order to get it working:

04Terrain.PNG

Let's assume you have a working terrain working with another terrain asset (it must be using the built-in terrain)

02tt.PNG

Setup the grass terrain just like described in the steps before, add the grass terrain material and the BF_Terrain.cs script.

03tt.PNG

Now you want to assign the terrain ground you want to layer your grass terrain on in the "terrainToCopy" parameter.

Then press the Sync Terrain Data button to sync the dimensions and height texture.

(I strongly recommend you to lower the geometry count on the grass terrain, you don't need as much precision for grass than ground terrain)

04tt.PNG

For the terrain layers you will need a first layer to be the "ground" or rather the transparent layer with metallic set to 1 just like the regular setup. Use this layer to remove grass and the others to draw grass.

05tt.PNG

Now you should be able to draw grass with the grass terrain and draw whatever you want with your other asset terrain!

Please keep in mind that these steps are only necessary when you want to use my grass shader terrain feature with other terrain assets, you do not need to do this if you only use my shaders.

If you're having trouble setting up a terrain with the grass shader here's a step-by-step video to complement the informations above:

bottom of page