Baltor Get started

Gallery / Godot shaders

Toon water with depth bands and contact foam

In your harnessGodot shaderMIT

Flat-shaded stylized water: colour steps from shallow to deep by the water depth read from the depth buffer, a foam band with a noisy edge around anything that touches the surface, and drifting ripple lines.

Render of Toon water with depth bands and contact foam
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Shader type
spatial
Render modes
unshaded, cull_back, depth_draw_never, shadows_disabled
Parameters
depth_texture (sampler2D), shallow_color (vec4 = 0.38, 0.86, 0.85, 0.7), deep_color (vec4 = 0.05, 0.32, 0.55, 0.95), depth_range (float = 1), color_steps (int = 3), foam_color (vec4 = 1, 1, 1, 1), foam_distance (float = 0.18), foam_noise_scale (float = 9) and 3 more
Use it on
Opaque terrain or objects below and through the water surface.
Result
Banded turquoise water with white foam rings around rocks and along the shallows.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/toon_water_foam/

Limits. Thickness is measured along the view ray, not vertically, so it grows at grazing angles. Transparent objects are not in the depth buffer and get no foam. Unshaded: the sun does not light the water. Flat surface; combine with a vertex wave shader for motion.

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 61.7 KB
Licence
MIT
Declared effects
reads files, runs commands
Checked with
Godot 4.7.2, opengl3 compatibility (Mesa llvmpipe, Xvfb)
Checks
contract static, engine run, engine log clean, shader in scene, capture written, render not uniform, shader changes pixels
Techniques
Depth buffer water thickness, Quantized colour steps, Noise-perturbed contact foam, Value noise with quintic interpolation and fractional Brownian motion
Tags
godot shader, spatial, water, toon, foam, depth buffer, stylized
Identity
library.supply.creative_originals.7c8f4cfdc97ca6f4ba060b78.2de153563db3058b
Version
2de153563db3058ba88a68a5db89165057db81c9e8650e8bebd558693ede5aa4

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.