Shadow map
Showcases the Parallel Split / Cascade shadow mapping technique.
Shadow mapping with a single, directional light source. It is intended to be a basis to start including your own shadow mapping system in your own project.
Key controls
Movement/view:
- Arrow keys and Page Up / Page Down — translate camera
- Mouse drag — rotate the camera
- F1 — switch to main camera
- F2 — switch to debug camera
Shadow configuration changes - watch the console output for changes:
- F3 — change shadow face culling mode
- F4 — shadow map alignment (camera/static)
- F5 / F6 — change layer split exponent
- F7 / F8 — tweak bias
- F9 / F10 — change number of layers
- F11 / F12 — change shadow map resolution
Credits
This example was originally contributed by Bill Robinson.
Source
Full source code is linked below and also available in the magnum-examples GitHub repository.
- CMakeLists.txt
- DebugLines.cpp
- DebugLines.h
- ShadowCaster.frag
- ShadowCaster.vert
- ShadowCasterDrawable.cpp
- ShadowCasterDrawable.h
- ShadowCasterShader.cpp
- ShadowCasterShader.h
- ShadowLight.cpp
- ShadowLight.h
- ShadowReceiver.frag
- ShadowReceiver.vert
- ShadowReceiverDrawable.cpp
- ShadowReceiverDrawable.h
- ShadowReceiverShader.cpp
- ShadowReceiverShader.h
- ShadowsExample.cpp
- Types.h