Soap Film, a Metal shader for SwiftUI
SwiftUI Metal shader

Soap Film

Thin-film interference on a bubble. A screen-space disc solves its own z to get a surface normal, two rounds of domain-warped fbm knead a thickness field across it, and a per-channel cosine of the optical path turns that thickness into colour. A mirrored copy of the field shades the back surface seen through the interior; the fringes brighten where the film folds and at grazing angles.

SwiftUIWeb

How it works

Soap Film is a real [[stitchable]] Metal shader, not a video or an image. It runs as a SwiftUI .colorEffect, so it paints any view you attach it to. You shape it with sliders in a live preview, then export the .metal file and the SwiftUI code that uses it, or the Web version. No MSL to write.

21 settings you can tune

  • Speed
  • Radius
  • Thickness
  • Warp
  • Crease
  • Rim strength
  • Spectrum
  • Halo
  • Deep
  • Body
  • Veil
  • Rim
  • Rim tint
  • Specular
  • Film
  • Bloom
  • Exposure
  • Colors
  • Edge softness
  • Glow
  • Glow tint

More SwiftUI shaders