Area lights
Basic real-time area lights.
This example is a basic implementation of Real-Time Polygonal-Light Shading with Linearly Transformed Cosines. Three lights are displayed, each with different orientation and parameters.
Controls
- W / A / S / D — move camera
- Mouse drag — look around
- R / Shift R — increase / decrease roughness of the plane
- M / Shift M — increase / decrease metalness of the plane
- F / Shift F — increase / decrease (specular reflection coefficient) of the plane
- F5 — reload shaders
Roughness, metallness and can be also configured through the UI.
Credits
This example was originally contributed by Jonathan Hale. The implementation is based on the paper "Real-Time Polygonal-Light Shading with Linearly Transformed Cosines" by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt. The *.dds
files are republished with a permission from Eric Heitz.
Source
Full source code is linked below and together with assets also available in the magnum-examples GitHub repository.
The ports branch contains additional patches for Emscripten and OpenGL ES support that aren't present in master
in order to keep the example code as simple as possible.