โ† All examples

godot shaders

Parallax fog bands

Drifting layered fog for 2D scenes: several fBm bands at different heights, speeds and opacities, denser toward the ground, drawn as a transparent overlay.

Recorded render of Parallax fog bands

What this component contains

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

How it works

Shader type
canvas_item
Parameters
fog_color (vec4 = 0.85, 0.88, 0.92, 1), density (float = 0.9), ground_line (float = 0.8), fog_height (float = 0.45), drift_speed (float = 0.04), scale (float = 3), layers (int = 3)
Use it on
A ColorRect above the scene covering the area that should show fog.
Result
Soft white fog banks drifting across the lower half of the city scene.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/fog_layers_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

Fog does not interact with scene depth: every layer covers everything under it. Large rectangles with many layers cost several fBm evaluations per pixel.