ShadowPass
ShadowPass renders the scene from the light's point of view into a depth-only framebuffer. The resulting shadow map is consumed by GeometryPass to evaluate shadow visibility per fragment.
Render Graph Role
| Attribute | Value |
|---|---|
| Group | Geometry |
| Reads | - |
| Writes | shadow_map (DEPTH_ONLY framebuffer) |
| Cullable | Yes |
Shadow Map
The shadow map is a transient DEPTH_ONLY framebuffer declared in the render graph:
uint32_t shadow_map = builder.declare_framebuffer(
"shadow_map", 2048, 2048,
FramebufferTextureFormat::DEPTH_ONLY
);
builder.add_pass(create_scope<ShadowPass>())
.write(shadow_map)
.end();Resolution is fixed at 2048×2048 by default. Higher values reduce aliasing at the cost of memory and fill rate.
Projection
ShadowPass constructs an orthographic light-space projection matrix from the active directional light's direction and the scene's bounding volume. The resulting light_space_matrix is stored in a logical buffer and read by GeometryPass to transform fragment positions into light space.
Shadow Technique
The pass implements PCF (Percentage Closer Filtering) with a 3×3 kernel. The kernel size and bias are configurable via the pass constructor.
Limitations
- Only a single directional light shadow is supported per frame.
- Point light shadows (cubemap shadow maps) are not yet implemented.