0.0.0 • Published 12 years ago
glsl-hemisphere-light v0.0.0
glsl-hemisphere-light 
A reusable GLSL hemisphere light function.
Usage
Exports vec3 hemisphere_light(), which takes the following arguments:
vec3 normal: This point's normal vector.vec3 sky: The "sky" color, cast from above the object.vec3 ground: The "ground" color, cast from below the object.vec3 lightDirection: The direction of the light to cast – normalized.mat4 modelMatrix: The model matrix.mat4 viewMatrix: The view matrix.vec3 viewPosition: The position of the camera in world space.
If you wish to include specular lighting too, simply add these two extra parameters when calling the function:
float shininess: Set to lower values for matte, higher for gloss.float specularity: The amount by which to scale the specular light cast on the object.
Also worth checking out:
- A brief explanation from Udacity.
- Example in three.js.
- The three.js implementation upon which this is based.
License
MIT. See LICENSE.md for details.
0.0.0
12 years ago

