glsl-specular-gaussian
Computes specular power from a Gaussian microfacet distribution
Example
# gaussSpec = require(glsl-specular-gaussian) uniform vec3 eyePosition;uniform vec3 lightPosition; uniform float shininess; varying vec3 surfacePosition;varying vec3 surfaceNormal; void
Usage
Install with npm:
npm install glsl-specular-gaussian
Then use with glslify.
API
# gaussSpec = require(glsl-specular-gaussian)
float gaussSpec(vec3 lightDir, vec3 eyeDir, vec3 normal, float shininess)
Computes the specular power in the Gaussian 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 size of the specular hight light. Smaller values give a sharper spot, while larger values give a more spread out highlight
Returns A float
representing the specular power
License
(c) 2014 Mikola Lysenko. MIT License