Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hughsk/glsl-hemisphere-light
A reusable GLSL hemisphere light function
https://github.com/hughsk/glsl-hemisphere-light
Last synced: 4 months ago
JSON representation
A reusable GLSL hemisphere light function
- Host: GitHub
- URL: https://github.com/hughsk/glsl-hemisphere-light
- Owner: hughsk
- License: mit
- Created: 2014-04-24T11:36:24.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-24T11:39:31.000Z (almost 11 years ago)
- Last Synced: 2024-10-17T16:39:39.405Z (4 months ago)
- Language: C
- Homepage: http://hughsk.io/glsl-hemisphere-light/
- Size: 1.05 MB
- Stars: 11
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# glsl-hemisphere-light [](http://github.com/hughsk/stability-badges) #
A reusable GLSL hemisphere light function.
[view demo](http://hughsk.io/glsl-hemisphere-light)
[](http://hughsk.io/glsl-hemisphere-light)
## Usage ##
[](https://nodei.co/npm/glsl-hemisphere-light)
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](https://www.youtube.com/watch?v=l7k32_BvkWA).
* [Example in three.js](http://pages.cs.wisc.edu/~lizy/mrdoob-three.js-ef5f05d/examples/webgl_lights_hemisphere.html).
* [The three.js implementation upon which this is based](http://git.io/R32neA).## License ##
MIT. See [LICENSE.md](http://github.com/hughsk/glsl-hemisphere-light/blob/master/LICENSE.md) for details.