glsl-diffuse-lambert
A simple Lambertian diffuse lighting model (somewhat trivial, but included for completeness).
Example
# lambert = require(glsl-diffuse-lambert) uniform vec3 lightPosition; varying vec3 surfacePosition, surfaceNormal; void
Usage
Install with npm:
npm install glsl-diffuse-lambert
Then use with glslify.
API
# lambert = require(glsl-diffuse-lambert)
float lambert(vec3 lightDir, vec3 normal)
Computes the diffuse intensity in the Lambertian model
lightDir
is a unit lengthvec3
pointing from the surface point toward the lightnormal
is the unit length surface normal at the sample point
Returns A float
representing the diffuse light intensity
License
(c) 2014 Mikola Lysenko. MIT License