The Interactive Grass package provides a production-oriented foliage shading system designed primarily for Unity's Universal Render Pipeline (URP). The core rendering mechanism utilizes custom HLSL subshaders integrated alongside Visual Effect Graph and Shader Graph representations, giving technical artists fine-grained control over vertex deformation, lighting response, and distance-based tessellation.
Deformation is executed directly in the vertex shader stage to minimize fragment overhead. Wind motion combines multi-layered sine wave evaluations with a sample from a scrolling world-space Simplex Noise texture. This dual-pass vertex pipeline provides smooth organic sway while retaining sharp, localized physics reactions when interacting objects cross the geometry bounds.
Foliage rendering inherently strains the rasterizer through high overdraw. The asset mitigates frame-rate drops by offering two primary render modes:
Integrating with URP post-processing stack layers—such as Screen Space Ambient Occlusion (SSAO) and Depth of Field—is maintained via standard depth-texture writes (`_CameraDepthTexture`), ensuring grass geometry properly registers in depth-based atmospheric effects.
Dynamic foliage response relies on an efficient interactor system. Rather than executing expensive per-blade physics colliders, interaction is computed algebraically inside the vertex shader by reading world-space position data supplied by standard C# mono-components.
The system supports two distinct methods for translating scene dynamics to vertex displacement:
Vector4 array via script. The vertex shader evaluates distance vectors relative to geometry roots and pushes vertices away from the origin point.To prevent material instantiation overhead and maintain batching efficiency, properties are injected at runtime using a MaterialPropertyBlock or through low-overhead global shader properties.
The standard inspector exposes intuitive controls for controlling physical attributes such as bend stiffness, elastic recovery speed, wind weight, and interactive influence radii. Configuring dynamic interactors requires a controller component attached to moving scene objects.
The following C# script demonstrates passing interactor positions directly to the standard grass shader pipeline using global vector arrays. Attach this component to a manager object or primary scene controller:
using UnityEngine;
[ExecuteAlways]
public class GrassInteractionController : MonoBehaviour
{
[Header("Interaction Settings")]
[SerializeField] private Transform[] interactors = new Transform[8];
[SerializeField] private float interactionRadius = 1.5f;
[SerializeField] private float displacementStrength = 2.0f;
private static readonly int InteractorPositionsID = Shader.PropertyToID("_GlobalGrassBufferPos");
private static readonly int InteractionParamsID = Shader.PropertyToID("_GlobalGrassParams");
private Vector4[] positionBuffer = new Vector4[16];
private void Update()
{
UpdateShaderGlobals();
}
private void UpdateShaderGlobals()
{
int activeCount = Mathf.Min(interactors.Length, positionBuffer.Length);
for (int i = 0; i < activeCount; i++)
{
if (interactors[i] != null)
{
Vector3 pos = interactors[i].position;
// Store XYZ position, W component holds individual radius scaler
positionBuffer[i] = new Vector4(pos.x, pos.y, pos.z, interactionRadius);
}
else
{
positionBuffer[i] = Vector4.zero;
}
}
Shader.SetGlobalVectorArray(InteractorPositionsID, positionBuffer);
Shader.SetGlobalVector(InteractionParamsID, new Vector4(displacementStrength, activeCount, 0f, 0f));
}
}
When deploying foliage shaders to mobile GPUs (such as ARM Mali or Qualcomm Adreno architectures), target performance hinges on tile-based deferred rendering (TBDR) bandwidth. The following profiling strategies ensure optimal framerates across target platforms:
Graphics.DrawMeshInstanced or URP SRP Batcher configurations to keep total draw calls minimal even across expansive terrain tiles.| Category | VFX / Shaders |
|---|---|
| Latest Version | v2.4 |
| File Size | 1.52 MB |
| Added to Platform | February 7, 2026 |
| Views | 3 views |
| Downloads | 1 downloads |
| Favourites | 0 favourites |
| Issue with Package? | Report Broken Link → |