thinFilmColor

The colour a thin transparent film (a coating, a soap skin, oil on water) reflects.

thinFilmColor(cosView: Expr, thickness: Expr, opts: {ior?: number} = {}): Expr

Import materials from shaders/std and use materials.thinFilmColor.

cosView is how face-on the surface is (1 face-on), thickness the film's thickness in nanometres (250–600 gives the vivid orders). Returns rgb around 0.5 on average: multiply a reflection by mix(1, 2·film, amount) to coat it.

Parameters

NameTypeNotes
cosViewExpr
thicknessExpr
opts{ior?: number}Optional. Default {}.

Example

const film = thinFilmColor(cosV, add(380, mul(sin(t), 120)))

See also

  • cosineRainbow — A smooth rainbow color from a value that wraps every 1.
  • schlickFresnel — How mirror-like a surface is at this pixel: r0 face-on, rising to r0 + gain at the rim.

Used by

PrismaticGlass