OpenGLContext.shadow.passes
Compound passes for rendering a shadowed scene...
The rendering passes here provide the bulk of the algorithm
for rendering shadowed scenes. You can follow the algorithm
starting at the OverallShadowPass, which manages 3 sets of
sub-passes:
ambient light passes (subPasses)
opaque-ambient-light pass
transparent-ambient-light pass
light pass (perLightPasses)
stencil setup pass
opaque-1-light pass
transparent-1-light pass
regular selection pass (postPasses)
The ambient light passes perform two major functions.
They set up the depth buffer with the scene's geometry
They add all of the ambient and emissive contribution
of the lights in the scene.
Each light then has two or three passes (depending on whether
there are transparent objects in the scene). The first pass
renders the shadow volume objects into the stencil buffer,
which creates a stencil shadow which marks off those areas
of the scene which are not illuminated by the current light.
The second pass renders the opaque geometry blending in the
contribution of the current light, with the stencil buffer
masking of those areas which are shadowed from the light.
If there are transparent objects, eventually we will render
them in much the same way, but at the moment, the depth buffer
is not being updated during the opaque render pass, so the
transparent objects will have undergo almost arbitrary lighting.
XXX Obviously that should change.
After the lighting passes are finished, the standard selection
rendering passes can occur.
Classes
class AmbientOnly(
object
):
Render with only ambient lights
Opaque rendering pass with only ambient lights
This will be the only pass which actually writes
to the depth buffer. It will also be responsible
for registering each light, and edge-set with the
appropriate matrices.
Transparent rendering pass with only ambient lights
class OverallShadowPass(
OverallPass
):
Pass w/ ambient, light-specific, and selection sub-passes
If we are doing no visible passes, then we are
basically just a regular selection pass.
Otherwise we need to do the ambient rendering
pass (possibly two if we have transparent objects),
with this pass finding and registering all
lights and edge-sets.
Then for each light:
Do the stencil-buffer set up pass, which walks
the list of edge sets (creating and) rendering
the shadow volume for the current light.
Do an opaque render with just the single light
enabled, and the stencil buffer excluding
shadowed geometry.
If there are transparent objects, render them
using the same set up as the opaque render.
Finally:
kill off the stencil buffer set up
__init__(
self
,
context
= None
,
subPasses
= ()
,
startTime
= None
,
perLightPasses
= ()
,
postPasses
= ()
)
Initialise OverallShadowPass
- perLightPasses
- list of passes to be applied to each light in the active light set
- postPasses
- list of passes applied after all of the light-specific passes are applied
class ShadowPassSet(
object
):
class SpecificLight(
object
):