Water Material
UE5 · Material Editor · World Position Offset · WPO Waves
A stylised water material inspired by Valheim — driven entirely by World Position Offset for mesh-deforming waves, with foam effects on shorelines and wave crests, Fresnel-based surface fading, and a world-height lerp that blends calm shallow water into open-ocean chop.
Overview
Valheim's water reads as water immediately — not because it's photorealistic, but because it moves correctly and reacts to the shore. This material replicates that approach in Unreal Engine 5 using World Position Offset to physically deform the water mesh, a depth-fade system for shoreline foam, and a world-height lerp to distinguish shallow from deep water. The result is a stylised surface that works at any camera distance without relying on screen-space effects or the built-in Water plugin.
World Position Offset Waves
The wave system stacks two sine waves — a primary long-wavelength swell and a secondary shorter chop — and feeds their combined output into the World Position Offset Z channel. This physically displaces the water mesh vertices at runtime, so the surface silhouette actually deforms rather than just scrolling a normal map. A third directional wave can be added for a crossing pattern. All wave parameters are exposed: amplitude, frequency, speed, and direction per wave layer.
- —Primary swell — low frequency, high amplitude, drives the large rolling motion
- —Secondary chop — higher frequency, lower amplitude, adds surface texture to the swell
- —Time node drives animation; speed scalar controls playback rate independently of frequency
- —Wave direction exposed as a 2D vector parameter — rotate to match wind direction
- —Amplitude and frequency exposed per layer for independent art-direction
Shoreline Foam
Shoreline foam uses a Scene Depth node to compute the distance between the water surface and the geometry beneath it. Where that depth is shallow — at the waterline — the depth value is remapped to a 0–1 foam mask and multiplied against a scrolling foam texture. The foam band width and intensity are exposed as scalar parameters. A wave-phase offset is added to the foam UV so the foam pulses in sync with the WPO wave crests arriving at the shore.
- —Scene Depth minus Pixel Depth gives the water-to-bottom distance
- —Remap node converts depth distance to a 0–1 foam mask with exposed near/far thresholds
- —Scrolling foam texture multiplied over the mask for organic edge detail
- —Wave phase offset syncs foam pulse to WPO wave arrival at the shoreline
- —Foam colour exposed as a vector parameter — white for ocean, tinted for swamp or lava
Wave Crest Foam
A second foam layer appears on wave peaks rather than at the shoreline. The WPO displacement magnitude is computed per-pixel and remapped to a 0–1 crest mask — pixels at the top of a wave get full foam, pixels in the trough get none. This mask drives a separate scrolling foam texture blended over the base water colour. The crest threshold and foam intensity are exposed so you can dial in subtle whitecaps or heavy breaking crests.
Fresnel Fading
A Fresnel node computes surface opacity based on the angle between the water normal and the camera direction. Pixels viewed at a steep angle (looking straight down into shallow water) are more transparent, revealing the seabed colour. Pixels viewed at a grazing angle (looking across the surface toward the horizon) are fully opaque. The Fresnel exponent and minimum opacity are exposed as parameters, giving control over how quickly the surface becomes transparent and how deep the water appears.
- —Fresnel exponent — controls the sharpness of the transparency falloff
- —Minimum opacity — prevents the surface from going fully transparent at steep angles
- —Deep water colour and shallow water colour lerped by the Fresnel value
- —Works with Translucent blend mode — no screen-space depth buffer required
Shoreline Wave Lerp
The world-height lerp blends between two wave configurations based on the absolute world-space Z position of the water mesh. Near-shore sections of the mesh (lower Z, shallower water) use the short-chop wave parameters; deep-water sections (higher Z in open ocean, or driven by a depth parameter) use the long-swell parameters. This means a single material instance can cover an entire body of water — from a rocky shoreline with choppy surf to a calm deep-ocean surface — without manual material assignment or vertex painting.
Parameters Reference
All tunable values are exposed as material parameters, organised into groups in the Material Instance editor.
- —Wave / Primary Swell — Amplitude, Frequency, Speed, Direction
- —Wave / Secondary Chop — Amplitude, Frequency, Speed
- —Foam / Shoreline — Depth Near, Depth Far, Intensity, Scroll Speed, Colour
- —Foam / Crest — Threshold, Intensity, Scroll Speed
- —Fresnel — Exponent, Min Opacity, Shallow Colour, Deep Colour
- —Depth Lerp — Shallow Z, Deep Z, Transition Width
// Key Features
- World Position Offset waves — mesh-deforming sine/cosine wave stack with exposed frequency, amplitude, and speed parameters
- Shoreline foam — depth-fade driven foam band that hugs the waterline and reacts to wave phase
- Wave crest foam — WPO displacement magnitude drives a secondary foam mask on wave peaks
- Fresnel fading — grazing-angle transparency blends the water surface into the horizon naturally
- Shoreline wave lerp — world-height blend transitions shallow near-shore chop into deep-water swells
- Valheim-inspired aesthetic — flat-shaded colour palette, bold foam contrast, and low-frequency wave silhouette
- Fully parameterised — all wave, foam, colour, and fade values exposed for per-instance tuning
// Downloads
// Project Info
- Engine
- UE 5.8
- Status
- In Progress
- Category
- Unreal Engine