Cloth, a Metal shader for SwiftUI
SwiftUI Metal shader

Cloth

Real fabric, simulated. A verlet sheet you can grab and pull — a solid colour with the fold in it and nothing laid over the top, or a thin-film sheet that shifts colour as it moves. Upload a picture and the cloth wears it.

SwiftUIWeb

How it works

Cloth 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.

22 settings you can tune

  • Style
  • Fabric
  • Picture
  • Picture glow
  • Picture tint
  • Animate
  • Breeze
  • Gravity
  • Drape
  • Speed
  • Grid
  • Sheet
  • Pins
  • Size
  • Distance
  • Tilt
  • Exposure
  • Grain
  • Sparkle
  • Backdrop
  • Falloff
  • Edge

More SwiftUI shaders