HomeUnreal EngineBetter Foliage Wind
CompleteUE 5.8

Better Foliage Wind

UE5 · Material Functions · World Position Offset · Static Mesh Foliage

UE5MaterialsMaterial FunctionsFoliageWorld Position OffsetEnvironment

A custom Material Function that plugs into the World Position Offset pin of any Static Mesh foliage material, replacing the stock Simple Grass Wind with a more organic, layered wind simulation — primary sway, secondary leaf flutter, and directional gusts all driven by a single Material Parameter Collection.

Overview

This Material Function replaces the built-in Simple Grass Wind node with a layered, physically-inspired wind simulation. It is designed to drop directly into the World Position Offset pin of any Static Mesh foliage material with no other changes required. All wind parameters are centralised in a single Material Parameter Collection so you can tune the entire scene from one place.

// Step Media

Material Parameter Collection

Before building the function, create a Material Parameter Collection (MPC) asset to hold all shared wind parameters. This lets every foliage material in the scene respond to the same wind settings simultaneously. 1. In the Content Browser, right-click → Materials → Material Parameter Collection. 2. Name it MPC_Wind (or similar). 3. Add scalar parameters: WindSpeed, SwayStrength, FlutterStrength, GustFrequency, RootMaskHardness. 4. Add a vector parameter: WindDirection (default X=1, Y=0, Z=0). 5. Save the MPC — you will reference it inside the Material Function nodes.

// Step Media

Sweeping Wave

The Sweeping Wave sub-graph produces the large, slow directional movement that simulates the whole plant bending in a sustained gust. 1. Add a CollectionParameter node and pull in WindDirection and WindSpeed from the MPC. 2. Feed WindDirection into a Dot Product with the mesh's world-space position to get a scalar wave phase. 3. Multiply the phase by WindSpeed, then pass it into a Sine node to get a smooth oscillating value. 4. Scale the result by SwayStrength and mask it by the Root Mask (built later) so the base of the mesh stays anchored. 5. Multiply the final scalar by the WindDirection vector to produce a directional offset ready to feed into the sway layer.

// Step Media

Flutter

Flutter adds high-frequency, small-amplitude noise to the tips of leaves and thin branches, giving the foliage a lively, organic feel independent of the main sway direction. 1. Create a SimpleNoise or Noise node set to a high frequency (start around 8–12). 2. Animate it over time using a Multiply of Time and a speed scalar from the MPC (tie it to WindSpeed for consistency). 3. Remap the noise output from [0,1] to [-1,1] using a ×2 − 1 operation. 4. Scale by FlutterStrength from the MPC. 5. Invert the Root Mask and multiply it against the flutter value so flutter is strongest at the tips and absent at the root.

// Step Media

Sway

Sway is the mid-frequency oscillation that represents individual branches moving back and forth. It sits between the slow sweeping wave and the fast flutter in both frequency and amplitude. 1. Duplicate the Sweeping Wave graph and increase the Sine frequency by a factor of 3–5×. 2. Reduce the amplitude scalar to roughly 30–40 % of the sweep strength. 3. Add a small per-instance random phase offset using ObjectPositionWS fed through a Frac node so neighbouring meshes do not oscillate in perfect sync. 4. Apply the Root Mask at partial strength (e.g. 0.5×) so the mid-trunk still moves slightly while the base remains anchored.

// Step Media

LERPs

The three motion layers (Sweep, Sway, Flutter) are blended together using a chain of Lerp nodes before being output as the final World Position Offset vector. 1. Lerp between zero and the Sweep offset using a weight of 1.0 (Sweep is always fully applied). 2. Add the Sway offset directly to the result (additive blend keeps both layers independent). 3. Lerp the Flutter scalar into a per-axis offset using the wind direction as a guide, then add it to the running total. 4. The combined vector is the output of the Material Function — connect it to the World Position Offset pin of the parent material.

// Step Media

Root Mask

The Root Mask prevents the base of the mesh from moving, which is essential for foliage that is planted in the ground. Without it, the entire mesh translates and floats off the surface. 1. Sample the mesh's local-space vertex position Z component (VertexNormalWS or a Transform node set to Local Space). 2. Remap the Z value so 0 (ground level) maps to 0 and the top of the mesh maps to 1. 3. Apply a Power node to control the hardness of the transition — higher exponents create a sharper cutoff at the base. 4. Expose the exponent as RootMaskHardness in the MPC so artists can tune it per-scene. 5. Multiply this mask against the Sweep and Sway offsets before the final Lerp chain.

// Step Media

Final Result

With all layers assembled and the Root Mask applied, the Material Function is complete. Plug it into the World Position Offset pin of any Static Mesh foliage material and adjust the MPC parameters to taste. The animated preview below shows the function running on a simple grass mesh in a scene with a moderate wind setting.

// Step Media

// Key Features

  • Drop-in Material Function replacement for Simple Grass Wind on any Static Mesh foliage
  • Three-layer wind model: primary trunk sway, secondary branch oscillation, and leaf flutter
  • Directional gust support driven by a wind direction vector parameter
  • All tuning exposed through a shared Material Parameter Collection for scene-wide wind control
  • Preserves mesh pivot-based bending so tall foliage bends correctly from the base

// Project Info

Engine
UE 5.8
Status
Complete
Category
Unreal Engine