Get the normal vector of a position within a signed distance field.
getNormal function into your shader. Note that
is required to be defined when using this module.
Your signed distance function, responsible for defining the
solid shapes in your scene. Accepts
position, and returns
vec2 – see glsl-raytrace
for more guidance :)
vec2# getNormal = require('glsl-sdf-normal', map = doModel)vec2
Gets the normal vector for the provided
Optionally, you may pass in a custom
epsilon value, which
determines the granularity at which to sample the field.
Defaults to 0.002.
See stackgl/contributing for details.
MIT. See LICENSE.md for details.