Website powered by

Foliage Shader - Unreal Engine 4

This foliage shader is the product of 2 weeks of work. I had this idea in my mind of making a game-ready foliage shader for a long time and i finally sat down and started sketching and brain storming how it would work and what it would need.
I came up with a simple set up that requires the least amount of textures and aims to be as user friendly as possible.
It consists of two shaders, a tree frond one called "foliage" and a trunk shader called "foliage_trunk".
It makes use of vertex animation to simulate the swaying of a tree (or any type of low-laying shrub as this is a very versatile shader) in the wind. The mesh vertex paint is what makes the animation happen under the hood: the RGB channels of the vertex paint control the overall intensity of the swaying, the very outer edges of the front and a phase alternation area for a more realistic, uneven wind sway.
The shader nodes are setup so that there is also a wind noise component, done with a cloud-like noise texture that is projected top down on the frond that adds a higher frequency movement wherever white is projected to achieve the fast swiweling around of the leaves.
The shaders are also seasons and weather enabled: they can change the amount of leaves and the color of them and also apply snow.
This took a long time to get right but i'm extremely happy with the result. The tree was made in TreeIt, retopologized and vertex painted in Blender and textured in Adobe Substance Painter all by me.

Wind Sway Speed Variable: Controls the sway frequency;

Wind Sway Speed Variable: Controls the sway frequency;

Wind Sway Intensity Variable: Controls the sway effect scale;

Wind Sway Intensity Variable: Controls the sway effect scale;

How the leaves are slowly faded away with the Seasonal Threshold Value Slider.

How the leaves are slowly faded away with the Seasonal Threshold Value Slider.

Seasonal Threshold Value in action: the leaves slowly fade away in layers while the color change. A better effect can be achieved if the tree frond texture has gradients ponting down to the branch on the leaves.

Seasonal Threshold Value in action: the leaves slowly fade away in layers while the color change. A better effect can be achieved if the tree frond texture has gradients ponting down to the branch on the leaves.

The trunk shader.

The trunk shader.

The vertex paint setup was made via shader nodes and baked into vertex paint in Blender 2.9

The vertex paint setup was made via shader nodes and baked into vertex paint in Blender 2.9

The texture set of the frond shader, explained.

The texture set of the frond shader, explained.

Shader Nodes: Frond Foliage Shader

Shader Nodes: Frond Foliage Shader