Technical

Before acquiring the A+ Grass asset, make sure it meets your needs, but also provides the functionality you are looking for.

This page provides information on how the asset works, what settings are needed, and what versions of Unity it is compatible with. For further understanding on optimizing draw calls, refer to Unity's documentation:

Unity Draw Calls

Compatibility

A+ Grass is compatible with Unity Editor Version 6000.0 and above. It was developed in Unity Editor Version 6000.3.9f1 with Universal Rendering Pipeline (URP)

Render Pipelines:

  • ✅ URP
  • ❌ HDRP
  • ❌ Built-In

Rendering Paths:

  • ✅ Forward
  • ✅ Forward +
  • ✅ Deferred
  • ✅ Deferred +

Unity Versions:

  • ✅ 6000.3 + (Developed in 6000.3.9f1)
  • ✅ 6000.0 + (Tested in 6000.0.71f1)

  • ✅ 2022 + (Tested in 2022.3.62f3)
  • 🚧 2022 - (Not tested below that version)

Recommended Settings

The assets was developed for the Universal Rendering Pipeline (URP) Here's recommended settings:

  • Depth + Opaque Texture - On (Not Used)
  • GPU Resident Drawer - Off (Not Used)
  • Dynamic Batching - Off
  • SRP Batcher - On
  • GPU Instancing - Off

Settings Overview


Depth Texture

Note: The shader doesn't sample depth texture and is not needed to function.

URP's depth texture is an extra render pass where the camera renders all opaque objects' depth into a screen-space texture. Shaders can then sample it to know the depth of the pixels behind other objects, used for soft particles or water edge detection.

A+ Grass shader never reads this texture as it writes depth via DepthOnly and DepthNormals passes which contribute to the depth texture, never sampling it.

GPU Resident Drawer

Note: The shader doesn't support GPU Resident Drawer and is not needed to function.

The GPU Resident Drawer automatically uses the BatchRendererGroup API to draw GameObjects with GPU instancing, which reduces the number of draw calls and frees CPU processing time. It keeps all mesh data persistently on the GPU, culls on the GPU and issues indirect draw calls. It's used to render Unity's Data-Oriented Technology Stack (DOTS) Entities. (Turn on/off in project settings, in the Render Pipeline Asset)

SRP Batcher is already handling the CPU overhead efficiently and therefore GPU Resident Drawer is not used.

Dynamic Batching

Note: The shader doesn't support dynamic batching and is not needed to function. Having it enabled will even waste CPU resources.

Dynamic batching works by combining multiple mesh vertices on the CPU every frame into a single vertex buffer, then issuing one draw call instead of many. Unity does this work on the main thread. For it to work, the vertex shader must produce the same result regardless of which object the vertex belongs to. (Turn on/off in project settings, in the Render Pipeline Asset)

A+ Grass shader could be batched through Dynamic Batching, but the CPU cost of merging all of the grass meshes' vertex buffers every frame would exceed the GPU savings from fewer draw calls.

SRP Batcher

Note: SRP Batcher takes over GPU Instancing. Use it in URP projects.

Traditional rendering uploads material properties to the GPU per draw call. If you have 500 grass meshes, that's 500 uploads of the same float/vector data every frame. SRP Batcher changes this. It persistently caches the CBUFFER_START(UnityPerMaterial) block on the GPU. Once uploaded, the data stays there until you actually change a property value. So those 500 grass meshes sharing the same material upload their CBUFFER once, not 500 times.

All of the properties are using CBUFFER_START(UnityPerMaterial), textures/samplers outside. Therefore within the URP project it will take priority over GPU Instancing if on, saving draw calls. (Turn on/off in project settings, in the Render Pipeline Asset)

GPU Instancing

Note: Use GPU Instancing in Built-In projects.

GPU Instancing tells the GPU to draw this exact same mesh x amount of times, here are x different transform matrices (and optionally x different property values). One draw call, x amount of objects. The GPU handles the repetition.

The shader supports GPU instancing through multi_compile_instancing with consideration of Built-In projects (But not currently supported). However, inside of URP project SRP Batcher takes priority, and you should use that instead. (Turn on/off at the bottom of the grass material.)