simvx.graphics.renderer.shadow_pass¶
Cascaded Shadow Map (CSM) rendering pass.
Module Contents¶
Classes¶
Renders depth from directional light’s POV into a cascaded shadow map atlas. |
Data¶
API¶
- simvx.graphics.renderer.shadow_pass.__all__¶
[‘ShadowPass’]
- simvx.graphics.renderer.shadow_pass.log¶
‘getLogger(…)’
- simvx.graphics.renderer.shadow_pass.MAX_CASCADE_COUNT¶
None
- simvx.graphics.renderer.shadow_pass.DEFAULT_CASCADE_COUNT¶
None
- simvx.graphics.renderer.shadow_pass.SHADOW_MAP_SIZE¶
2048
- simvx.graphics.renderer.shadow_pass.DEPTH_FORMAT¶
None
- class simvx.graphics.renderer.shadow_pass.ShadowPass(engine: Any)[source]¶
Renders depth from directional light’s POV into a cascaded shadow map atlas.
Atlas layout:
MAX_CASCADE_COUNTimages side-by-side horizontally. Total size:SHADOW_MAP_SIZE * MAX_CASCADE_COUNT × SHADOW_MAP_SIZE. The fragment shader’s loop iteratesactive_cascade_countslices so 1–4 cascades can be selected at runtime viaWorldEnvironment.shadow_cascade_countwithout recompiling shaders.Initialization
- compute_cascades(view: numpy.ndarray, proj: numpy.ndarray, light_dir: numpy.ndarray, near: float = 0.0, far: float = 0.0) None[source]¶
Compute cascade split distances and light-space VP matrices.
Delegates to
shadow_math.compute_cascadesforself.cascade_countslices and transposes to GLSL column-major for the SSBO upload. Slots beyondself.cascade_countare zeroed so the shader’sactive_cascade_countclamp leaves them untouched.
- render(cmd: Any, instances: list, ssbo_set: Any, mesh_registry: Any, multimesh_draws: list | None = None, materials: numpy.ndarray | None = None) None[source]¶
Record shadow depth rendering commands for per-instance and MultiMesh draws.
multimesh_drawsentries are 9-tuples: (mesh_handle, base, count, vp_id, double_sided, centres, radii, union_min, union_max). Each block is drawn as ONE instanced shadow command (first_instance=base, instance_count=count) per cascade – coarse, no per-instance cull.materialsis the renderer’s material SSBO array; per-instance casters whose material is alpha-tested (blend="cutoff") are routed through the cutout pipeline, which discards holed fragments so the shadow shows the cutout. With no cutout caster present the cutout list is empty and the opaque draw set is byte-identical to the plain opaque pass.