nudgeNormal

Tilts a normal by a slope in x and y, turning a height field into relief.

nudgeNormal(n: Expr, dx: Expr, dy: Expr, hint: string = 'n'): Expr

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

Feed it the dx/dy of fdSlope or perlinSlope, scaled by how strong you want the relief. Works on a flat vec3(0, 0, -1) normal as well as a shape's normal.

Parameters

NameTypeNotes
nExpr
dxExpr
dyExpr
hintstringOptional. Default 'n'.

Example

const n = nudgeNormal(vec3(0, 0, -1), mul(relief.dx, 0.08), mul(relief.dy, 0.08))

See also

  • fdSlope — The value and slope of any field at a point: value, dx and dy.
  • perlinSlope — The slope of smooth noise at a point, for wavy or molten relief.
  • tiltNormal — Tilts a normal along and across a direction, for brushed or woven relief.
  • geometricNormal — The surface normal of the shape, whichever kind of shape is active.

Used by

Chrome, Frost, LiquidMetal, Plastic