โ† All examples

godot shaders

Thin-film interference iridescence

Iridescent colours of soap bubbles and oil films from a two-beam thin-film interference estimate per colour channel, with film thickness swirled by noise so the colours drift.

Recorded render of Thin-film interference iridescence

What this component contains

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

How it works

Shader type
spatial
Render modes
cull_back, depth_draw_always
Parameters
film_index (float = 1.33), thickness_min_nm (float = 250), thickness_max_nm (float = 750), swirl_scale (float = 2), swirl_speed (float = 0.15), opacity (float = 0.35), roughness (float = 0.05), base_color (vec4 = 0.02, 0.02, 0.03, 1)
Result
A clear bubble whose reflections shimmer in bands of magenta, green and gold that drift.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/thin_film_iridescence/

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

Two-beam approximation at three wavelengths, not a spectral integration: colours are plausible, not exact. Multiple reflections inside the film are ignored. Transparency uses Godot's alpha blending and is not sorted per pixel.