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

Create an empty gameobject and new camera as children
HDRP
Create 3 camera - projector(ground layer), killer & motion camera
Killer & motion camera have no special set up, just name it properly

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
Projector, killer & motion camera have no special set up, just name it properly

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

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

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

Drag and drop the camera and render texture you just created
Camera size = the area that spawn grass
Press Apply Settings
3.VFX

Under the GrassManager, create an empty gameobject
Attach the vfx (GrassProjector_Vfx) on it
Attach VFXPropertyBinder.cs
Bind 2 corresponding as shown above, either HDRP/URP
Attach GrassSetting.cs, drag the corresponding Vfx
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