anisoSpecular

A highlight stretched along a grain, as on brushed metal or carbon fibre.

anisoSpecular(opts: {
    normal: Expr
    /** The 2D grain direction. */
    tangent: Expr
    /** A unit 3D light direction (see `lightVec3`). */
    light: Expr
    view: Expr
    alphas: {along: Expr; across: Expr}
    gain?: Expr | number
}): Expr

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

tangent is the 2D grain direction, light a unit 3D light vector, view the view ray and alphas the widths from wardAlphas. Pass gain or scale the result yourself.

Parameters

NameTypeNotes
opts`{
normal: Expr
/** The 2D grain direction. */
tangent: Expr
/** A unit 3D light direction (see `lightVec3`). */
light: Expr
view: Expr
alphas: {along: Expr; across: Expr}
gain?: Expr \| number

}` | |

Example

const spec = anisoSpecular({normal: n, tangent: brush.tangent, light: lightVec3(direction(u.lightAngle), -0.7), view, alphas: wardAlphas(rough, aniso), gain: u.specular})

See also

  • wardAlphas — Turns roughness and anisotropy sliders (0–1 each) into the two lobe widths anisoSpecular takes.
  • lightVec3 — A 3D light direction from a direction() vector and an elevation.
  • sharpGlint — A highlight whose tightness follows a sharpness slider.
  • dualLobeGlint — A highlight with a tight hot core and a wide dim halo.

Used by

BrushedMetal, CarbonFiber