glsl-diffuse-oren-nayar
The Oren-Nayar diffuse lighting model implemented in GLSL.
Example
# orenNayar = require(glsl-diffuse-orenNayar) uniform vec3 lightPosition, eyePosition; varying vec3 surfacePosition, surfaceNormal; void
Usage
Install with npm:
npm install glsl-diffuse-oren-nayar
Then use with glslify.
API
# orenNayar = require(glsl-diffuse-oren-nayar)
float orenNayar(vec3 lightDir, vec3 viewDir, vec3 normal, float roughness, float albedo)
Computes the diffuse intensity in the Lambertian model
lightDir
is a unit lengthvec3
pointing from the surface point toward the lightviewDir
is a unit lengthvec3
pointing toward the cameranormal
is the unit length surface normal at the sample pointroughness
is a parameter between 0 and 1 measuring the surface roughness. 0 for smooth, 1 for mattealbedo
measures the intensity of the diffuse reflection. Values>0.96
do not conserve energy
Returns A float
representing the diffuse light intensity
License
(c) 2014 Mikola Lysenko. MIT License