The Oren-Nayar diffuse lighting model implemented in GLSL.
#pragma glslify: orenNayar = require(glsl-diffuse-orenNayar)
uniform vec3 lightPosition, eyePosition;
varying vec3 surfacePosition, surfaceNormal;
void main() {
  //Light and view geometry
  vec3 lightDirection = normalize(lightPosition - surfacePosition);
  vec3 viewDirection = normalize(eyePosition - surfacePosition);
  //Surface properties
  vec3 normal = normalize(surfaceNormal);
  
  //Compute diffuse light intensity
  float power = orenNayar(
    lightDirection,
    viewDirection, 
    normal,
    0.3,
    0.7);
  gl_FragColor = vec4(power,power,power,1.0);
}Install with npm:
npm install glsl-diffuse-oren-nayar
Then use with glslify.
#pragma glslify: orenNayar = require(glsl-diffuse-oren-nayar)Computes the diffuse intensity in the Lambertian model
lightDiris a unit lengthvec3pointing from the surface point toward the lightviewDiris a unit lengthvec3pointing toward the cameranormalis the unit length surface normal at the sample pointroughnessis a parameter between 0 and 1 measuring the surface roughness. 0 for smooth, 1 for mattealbedomeasures the intensity of the diffuse reflection. Values>0.96do not conserve energy
Returns A float representing the diffuse light intensity
(c) 2014 Mikola Lysenko. MIT License