simvx.graphics.renderer.light2d_pass

2D light accumulation pass — renders Light2D nodes as additive radial gradients.

Renders each light as a screen-space quad with radial falloff. The accumulated light texture is provided to Draw2DPass for final compositing (multiply blend).

Shadow casting uses a simple 1D angular shadow map per light: for each angle, a ray is cast from the light center and the nearest occluder intersection distance is stored. The fragment shader compares its distance against this map to determine if it is in shadow.

Module Contents

Classes

Light2DPass

GPU pass that renders 2D lights to an offscreen accumulation texture.

Data

API

simvx.graphics.renderer.light2d_pass.__all__

[‘Light2DPass’]

simvx.graphics.renderer.light2d_pass.log

‘getLogger(…)’

simvx.graphics.renderer.light2d_pass.PUSH_SIZE

48

simvx.graphics.renderer.light2d_pass.SHADOW_MAP_RESOLUTION

64

class simvx.graphics.renderer.light2d_pass.Light2DPass(engine: Any)

GPU pass that renders 2D lights to an offscreen accumulation texture.

Usage from the forward renderer: 1. begin_frame() — clears per-frame submission lists 2. submit_light(...) / submit_occluder(...) — queue data 3. render(cmd, extent) — render all lights to accumulation RT 4. get_light_texture_view() — returns the image view for compositing

Initialization

setup() None

Create GPU resources: shaders, pipeline, render target.

submit_light(position: tuple[float, float], color: tuple[float, float, float], energy: float, light_range: float, falloff: float = 1.0, blend_mode: str = 'add', shadow_enabled: bool = False, shadow_color: tuple[float, ...] = (0.0, 0.0, 0.0, 0.5)) None

Queue a light for rendering this frame.

submit_occluder(polygon_vertices: list[tuple[float, float]]) None

Queue an occluder polygon for shadow casting this frame.

begin_frame() None

Clear per-frame submission lists.

render(cmd: Any, extent: tuple[int, int]) None

Render all queued lights to the accumulation render target.

Must be called outside the main render pass (in pre_render phase).

get_light_texture_view() Any

Return the light accumulation image view for compositing.

get_light_sampler() Any

Return the sampler for the light accumulation texture.

property has_lights: bool

True if any lights were submitted this frame.

cleanup() None

Destroy all GPU resources.