6.3.2 Generating shadow cubemaps
Start with a local environment to which you want to apply shadows from light sources outside of the environment. For example, a room, a cave, or a cage.
Create the shadow cubemap in the same manner as the reflection cubemap
but you must also add an alpha channel. The alpha channel or transparency, represents
the amount of light entering the local environment.
Work out the position from where to render the six faces of the cubemap. In
most cases this is in the center of the bounding box of the local environment. You
require this position for the generation of the cubemap. You must also pass this
position to the shaders to calculate a local correction vector to fetch the right texel
from the cubemap.
When you have decided where to position the center of the cubemap, you can
render all the faces to the cubemap texture and record the transparency or alpha of the
local environment. The more transparent an area is, the more light that comes into the
environment. If there is no geometry it is fully transparent. If required, you can use
the RGB channels to store the color of the environment for colored shadows such as
stained glass, reflections, or refractions.