Only one light source would be able to cast shadows, and that would be marked with a shadows: true property.
Would be possible to allow multiple Cameras in the scene, but only one camera would "see" the shadows. That Camera would probably be marked with a shadows: true property. That would possibly make sense for the case when a second Camera is being used for things like HUDs.
Implementation
Render graph
Within the render graph, would implement a separate first-priority bin of draw list objects that would render to a shadow (depth) buffer. For that bin, the eye position for their Camera would be temporarily set to the location of the light source.
Then the eye position is restored to that of the `Camera`` and the normal draw list objects are rendered while doing the standard fragment / shadow buffer depth comparisons and color adjustments.
Shaders
Requires an additional "shadow" shader program to be auto-generated, which would not involve any lighting texturing calculations, where it would just be writing the geometry fragment depths to the shadow buffer.
Also requires the shadow buffer to be passed into the regular drawing fragment shader, with the fragment/depth comparisons, both conditionally generated when shadows are in effect (ie light source exists with the shaodws: true property).
Limitations
Only one light source would be able to cast shadows, and that would be marked with a
shadows: true
property.Would be possible to allow multiple
Cameras
in the scene, but only one camera would "see" the shadows. ThatCamera
would probably be marked with ashadows: true
property. That would possibly make sense for the case when a secondCamera
is being used for things like HUDs.Implementation
Render graph
Within the render graph, would implement a separate first-priority bin of draw list objects that would render to a shadow (depth) buffer. For that bin, the eye position for their
Camera
would be temporarily set to the location of the light source.Then the eye position is restored to that of the `Camera`` and the normal draw list objects are rendered while doing the standard fragment / shadow buffer depth comparisons and color adjustments.
Shaders
Requires an additional "shadow" shader program to be auto-generated, which would not involve any lighting texturing calculations, where it would just be writing the geometry fragment depths to the shadow buffer.
Also requires the shadow buffer to be passed into the regular drawing fragment shader, with the fragment/depth comparisons, both conditionally generated when shadows are in effect (ie light source exists with the
shaodws: true
property).