2.16
Shadows

- 2.16.1. Overview
- 2.16.2. Shadow Geometry

2.16.1
Overview
1
Because the r2 package implements local illumination, it is necessary to associate shadows with those light sources capable of projecting them (currently only projective lights). The r2 package currently only supports variance shadow mapping. So-called mapped shadows allow efficient per-pixel shadows to be calculated with varying degrees of visual quality.
2.16.2
Shadow Geometry
1
Because the system requires the programmer to explicitly and separately state that an opaque instance is visible in the scene, and that an opaque instance is casting a shadow, it becomes possible to effectively specify different shadow geometry for a given instance. As an example, a very complex and high resolution mesh may still have the silhouette of a simple sphere, and therefore the user can separately add the high resolution mesh to a scene as a visible instance, but add a low resolution version of the mesh as an invisible shadow-casting instance with the same transform. As a rather extreme example, assuming a high resolution mesh m0 added to the scene as both a visible instance and a shadow caster:
2.16.2.2 Visible and shadow casting (High)
3
A low resolution mesh m1 added to the scene as both a visible instance and shadow caster:
2.16.2.4 Visible and shadow casting (Low)
5
Now, with m1 added as only a shadow caster, and m0 added as only a visible instance:
2.16.2.6 Visible and shadow casting (Low shadow, high visible)
7
Using lower resolution geometry for shadow casters can lead to efficiency gains on systems where vertex processing is expensive.