# How it works

Vfx grass generate grass using Vfx Graph, like many other shaders to make it more dynamic and easy to customize it uses camera and render texture to "paint" some of the visual effect.&#x20;

And there is a slight different between HDRP and URP due to the rendering tech behind.

## HDRP

<figure><img src="https://3374031394-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJZW2zR4mbZfSyHYuAIWI%2Fuploads%2FS9fSQbt9ivwXTEWmVTv1%2FvfxGrassHDRP.jpg?alt=media&#x26;token=780d0954-6a73-4bee-8236-e126018f76d9" alt=""><figcaption></figcaption></figure>

HDRP uses 3 camera:

* Projector Camera to capture&#x20;
  * Albedo buffer - ground color
  * Depth buffer - grass position
  * Normal buffer - initial grass direction (following terrain or suface normal)
* Killer Camera&#x20;
  * Depth buffer - no grass position
* Motion Camera&#x20;
  * "Painting" motion vector for grass interaction

## URP

<figure><img src="https://3374031394-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJZW2zR4mbZfSyHYuAIWI%2Fuploads%2F3yXXhITYt3mbIR983WnL%2FvfxGrassURP.jpg?alt=media&#x26;token=ebac02e1-4934-486c-8491-ea71e1caa8dc" alt=""><figcaption></figcaption></figure>

HDRP uses 4 camera:

* Projector Camera to capture&#x20;
  * Ground color directly from camera to render texture
  * Depth buffer - grass position
* Normal Camera
  * Normal buffer - initial grass direction (following terrain or suface normal)
* Killer Camera&#x20;
  * Depth buffer - no grass position
* Motion Camera&#x20;
  * "Painting" motion vector for grass interaction

## Difference

<table><thead><tr><th width="135"></th><th>HDRP</th><th>URP</th></tr></thead><tbody><tr><td>Ground Color</td><td>using C#, grabbing the Albedo buffer from the camera</td><td>Directly from camera to render texture</td></tr><tr><td>Normal</td><td>From camera using custom pass volume</td><td>From camera using Custom Universal Renderer</td></tr></tbody></table>
