Website powered by

Unreal Engine System - Simple Grass Interaction System

Here's a simple grass interaction system that allows for your character (and your character only) to interact with the grass in a very satisfying way. It's available as a Tier 2 reward on my Patreon: https://www.patreon.com/GhislainGir

It's mostly only shader-driven. Blueprint/CPU usage is minimal and just keep tracks of 6 virtual particles spawned by the player at a constant interval.

You'll want to know how to bake the pivots if you intend to use this system for your own grass meshes :)

A deep dive into the system

Quick demo.

Grass bends back & forth quite nicely.

Grass bends back & forth quite nicely.

Complex rotation behaviour.

Complex rotation behaviour.

You could choose to create an effect based on the interaction amount.

You could choose to create an effect based on the interaction amount.

Debug view of the virtual particles spawned by the player.

Debug view of the virtual particles spawned by the player.

Since this effect is mostly GPU driven and costs quite a bit of vertex instructions, it's recommended to have a strict usage of LODs to turn off the grass interaction on distant grass meshes.

Since this effect is mostly GPU driven and costs quite a bit of vertex instructions, it's recommended to have a strict usage of LODs to turn off the grass interaction on distant grass meshes.

The blueprint component spawns a new 'virtual particle' at a constant interval. It's all precisely timed so it recycles the oldest virtual particle already spawned just when it's about to end its life.

The blueprint component spawns a new 'virtual particle' at a constant interval. It's all precisely timed so it recycles the oldest virtual particle already spawned just when it's about to end its life.

A material collection is used to contain all 6 particles' data: 3D location (RGB), timestamps (A) and 3D velocity (RGB/A) plus some overall settings.

A material collection is used to contain all 6 particles' data: 3D location (RGB), timestamps (A) and 3D velocity (RGB/A) plus some overall settings.

The interaction material function used in the grass material samples each particle to know if it should be affected by it and sums the velocity of all nearby particles.

The interaction material function used in the grass material samples each particle to know if it should be affected by it and sums the velocity of all nearby particles.

The overall velocity is then converted to an axis & angle to rotate the grass blades with a back & forth swing motion.

The overall velocity is then converted to an axis & angle to rotate the grass blades with a back & forth swing motion.

For each particle we do a distance check and the closer a grass vertex is to a particle, the more affected it is by its velocity. That velocity is modulated by a curve based on the particle's timestamp to get that back & forth swing motion.

For each particle we do a distance check and the closer a grass vertex is to a particle, the more affected it is by its velocity. That velocity is modulated by a curve based on the particle's timestamp to get that back & forth swing motion.