lights

Light sources for Algan’s ray-traced renderer.

Mirrors the Three.js light catalogue: PointLight, DirectionalLight, AmbientLight, HemisphereLight, SpotLight and RectAreaLight, each with an intensity multiplier. Point and spot lights expose artistic decay/distance falloff controls; rectangular area lights always use physical emission.

Lights use the Mob authoring interface: their location, color, opacity and intensity are animatable like any other mob attribute. The remaining parameters (decay, distance, cone angles, emitter sizes) are plain per-light constants.

Soft (penumbra) shadows: point / spot lights take a shadow_radius (the world-space radius of the emitting disk) and directional lights a shadow_angle (angular size, degrees); when non-zero and ray-traced shadows are enabled (set_shadows()) the deterministic tracer fires a fixed fan of shadow rays across the emitter instead of a single ray, producing smooth penumbras. RectAreaLight is sampled at a fixed grid of emitter points (samples), and each row’s fan integrates visibility over its own cell of the rectangle rather than testing only the cell’s centre, so its penumbra is continuous rather than a stack of hard shadows – gated by area_light_soft_shadows, at the ray cost noted on RectAreaLight.

Both the deterministic fragment-shading route and the path tracer support the packed extended light types. The deterministic renderer enables fragment shading when an extended light requires it. Path tracing samples direct light and can merge rectangular emitters into visible geometry; point, directional and ambient light objects are not themselves visible meshes. See raytracing/DESIGN_physical_area_lights.md for emitter geometry and the legacy distance-falloff convention.

Classes

AmbientLight

Uniform, direction-less illumination applied to every surface.

DirectionalLight

Sun-like light: parallel rays along normalize(target - location), no distance falloff.

HemisphereLight

Sky/ground gradient ambient: surfaces facing up receive the light's color (sky), surfaces facing away receive ground_color.

Light

Base class of all light sources.

PointLight

Omnidirectional light emitting from a single point.

RectAreaLight

Emit light from a one-sided rectangular surface.

SpotLight

Cone of light aimed at a target.

Functions

light_is_extended(light)[source]

True when light needs the extended packed-light row (any light beyond a plain, falloff-free point light).