โ† All examples

godot shaders

Drifting 2D clouds with self-shading

Draw a sky with drifting clouds from fractional Brownian motion: a coverage threshold shapes the clouds, a second lookup toward the sun shades their undersides, and the sky behind follows a vertical gradient.

Recorded render of Drifting 2D clouds with self-shading

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • clouds_fbm_2d.gdshader
  • component.json
  • demo.tscn
  • inspect_shader.py
  • material.tres
  • preview.png
  • test_package.py
  • verification/native.json

How it works

Shader type
canvas_item
Parameters
sky_top (vec4 = 0.25, 0.5, 0.88, 1), sky_bottom (vec4 = 0.7, 0.85, 0.98, 1), cloud_light (vec4 = 1, 1, 1, 1), cloud_shadow (vec4 = 0.55, 0.6, 0.72, 1), coverage (float = 0.5), softness (float = 0.15), scale (float = 3), wind_speed (float = 0.03) and 2 more
Use it on
A ColorRect (or any CanvasItem) sized to the area to fill; UVs span 0 to 1 across it.
Result
A blue sky gradient with white puffy clouds shaded grey on one side.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/clouds_fbm_2d/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • contract_static
  • engine_run
  • engine_log_clean
  • shader_in_scene
  • capture_written
  • render_not_uniform
  • shader_changes_pixels

Limits to consider

One shading step, not light marching, so thick clouds lack depth. Clouds repeat with no structure at very large scales.