glsl-specular-blinn-phong
Computes the Blinn-Phong specular weight for a light source
Example
# blinnPhongSpec = require(glsl-specular-blinn-phong) uniform vec3 eyePosition;uniform vec3 lightPosition; uniform float shininess; varying vec3 surfacePosition;varying vec3 surfaceNormal; void
Usage
Install with npm:
npm install glsl-specular-blinn-phong
Then use with glslify.
API
# blinnPhong = require(glsl-specular-blinn-phong)
float blinnPhong(vec3 lightDir, vec3 eyeDir, vec3 normal, float shininess)
Computes the specular power in the Blinn-Phong lighting model.
lightDir
is a unit lengthvec3
pointing from the surface point toward the lighteyeDir
is a unit lengthvec3
pointing from the surface point toward the cameranormal
is the surface normal at the sample pointshininess
is the exponent in the Phong equation (default20.0
)
Returns A float
representing the power of the Blinn-Phong lighting equation
License
(c) 2014 Mikola Lysenko. MIT License