Get Started

Asset dependency

Make sure you have these asset installed

  • URP/HDRP

  • Unity Shader Graph

  • Unity Vfx Graph

  • Gradient Texture Generator (my free asset)

Set up

1.Layer & RenderTexture

Create 4 Render Texture and 3 layer

  • Color Format of the Render Texture has to be R16G16B16A16_SFLOAT/R32G32B32A32_SFLOAT

  • 3 Layer for Ground, GrassKiller & GrassMotion

2.Camera

  1. Create an empty gameobject and new camera as children

HDRP

Create 3 camera - projector(ground layer), killer & motion camera

  1. Killer & motion camera have no special set up, just name it properly

  2. Attach a Custome Pass Volume to the Projector Camera, make it the target camera and use NoramlBufferHDRP as fullscreen material for a FullScreenscreenCustomPass

URP

Create 4 camera - projector(ground layer), normal, killer & motion camera

  1. Projector, killer & motion camera have no special set up, just name it properly

  2. Add a Full Screen Pass Renderer Feature to a new Universal Renderer Data with NormalBufferURP as Pass Material

  3. Add the Universal Renderer Data you just created to your Universal Render Pipeline Asset's Renderer List

  4. Set the Universal Renderer Data you just created as the Renderer on normal camera

After creating camera(HDRP/URP)

Attach a script - GrassManager.cs to the empty parent gameobject - the root of all camera

  1. Drag and drop the camera and render texture you just created

  2. Camera size = the area that spawn grass

  3. Press Apply Settings


3.VFX

  1. Under the GrassManager, create an empty gameobject

    1. Attach the vfx (GrassProjector_Vfx) on it

    2. Attach VFXPropertyBinder.cs

      1. Bind 2 corresponding as shown above, either HDRP/URP

    3. Attach GrassSetting.cs, drag the corresponding Vfx

  2. Go back to the GrassManager Attach the corresponding Vfx, hit Apply Settings. Now you are good to go, start playing around with GrassSetting to create the grass you want.


4.GrassKiller

Any object (no need collider) under "Grass Killer" layer will be capture by the grass killer camera's depth buffer

You could cover up the area you don't want grass with any object under "Grass Killer" layer to remove the grass over there.


5.Motion

Attach this vfx under any interactive object and make it GrassMotion Layer, now it will push the grass away

Last updated