Skip to content

ShaderLightingRenderer

Defined in: lighting/src/ShaderLightingRenderer.ts:104

Draws soft-edged radial lights into an offscreen buffer, then multiplies that buffer over the scene.

Each light is one quad whose fragment shader runs the projection LightingWorld.levelAt() runs: the lamp is a line of width size square to the direction from the shaded pixel, every occluder in reach hides a stretch of it, and what is left is how brightly that pixel is lit. A shadow’s border therefore widens with the distance from the blocker, a lamp wider than its blocker lights around it, and a cone’s softness fades its edge — all from one formula, with no geometry per shadow.

The drawn picture is what levelAt() answers, within the coverage steps the shader counts in and the light buffer’s 8 bits per channel. Occluder shapes reach the shader through one data texture the scene’s lights share, rebuilt only for the lights that moved.

The bounced light the scene resolved to reaches the picture through LightingComposite, which every lighting renderer shares.

new ShaderLightingRenderer(context, options?): ShaderLightingRenderer

Defined in: lighting/src/ShaderLightingRenderer.ts:122

LightingRendererContext

ShaderLightingRendererOptions = {}

ShaderLightingRenderer

destroy(): void

Defined in: lighting/src/ShaderLightingRenderer.ts:189

Release every resource owned by this scene’s backend.

void

LightingRenderer.destroy


render(frame): void

Defined in: lighting/src/ShaderLightingRenderer.ts:171

Synchronize the backend with the world’s current lights and view.

LightingRenderFrame

void

LightingRenderer.render

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/lighting.md.