refract

The direction i bent through a surface with unit normal n.

refract(i: Val, n: Val, eta: Val): Expr

Import math from shaders/std and use math.refract.

eta is the ratio of refractive indices, about 0.66 going from air into glass.

Parameters

NameTypeNotes
iVal
nVal
etaVal

Example

const bent = refract(viewDir, normal, 0.66)

See also

  • reflect — The direction i bounced off a surface with unit normal n.