Skip to content

specular

plot · scripts/plot/appearance/specular.m

: r = specular (sx, sy, sz, lv, vv)
: r = specular (sx, sy, sz, lv, vv, se)

Specular reflectance of surface normals.

sx, sy and sz are equally sized arrays with the components of the surface normals, lv the direction towards the light and vv the direction towards the viewer (each a 3-element vector or an [azimuth elevation] pair in degrees) and se the specular exponent (default 10, may be Inf).

With unit vectors, the light direction mirrored about the normal is r = 2 (n . l) n - l, and the result is max (0, r . v)^se, or 0 where the light is behind the surface.