schlickFresnel

How mirror-like a surface is at this pixel: r0 face-on, rising to r0 + gain at the rim.

schlickFresnel(
  grazing: Expr,
  opts: {r0?: number; gain: Expr | number; power?: number},
): Expr

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

grazing comes from grazingOf or grazingFlat. Glass is {r0: 0.04, gain: 0.96}. Lower the gain to keep the rim from turning into a full mirror over an interior.

Parameters

NameTypeNotes
grazingExpr
opts{r0?: number; gain: Expr | number; power?: number}

Example

const fresnel = schlickFresnel(grazingOf(n, view), {gain: 0.6})

See also

  • fresnelBoost — A multiplier that brightens grazing edges: 1 face-on, up to 1 + amount at the rim.
  • grazingOf — How edge-on the surface is to the viewer: 0 face-on, 1 grazing.
  • reflect — The direction i bounced off a surface with unit normal n.

Used by

Obsidian, Voxels, Water