RectAreaLight

Qualified name: algan.rendering.lights.RectAreaLight

class RectAreaLight(*args, width=2.0, height=2.0, target=tensor([0., 0., 0.]), samples=4, decay=2.0, distance=0.0, **kwargs)[source]

Bases: _TargetedLight

Emit light from a one-sided rectangular surface.

The rectangle is centred on location and faces target. Emitted radiance is constant with distance; illumination falls off through geometry and has no artificial range cutoff. The path tracer shows the opaque panel to camera, reflection and refraction rays: its front emits and its back is black. The single-sample renderer integrates a fixed grid of emitting cells but does not display the panel itself.

intensity keeps its existing area-light normalization: for area A, the emitted linear-RGB radiance is color * intensity / A (including the usual opacity/glow multipliers). Thus increasing the area at fixed intensity spreads the same total power over a larger, dimmer panel. The one-sided Lambertian flux is pi * color * intensity. This is a scene-linear convention, not a calibrated photometric watt or lumen.

Animation

Location, color, opacity and intensity follow their normal Mob animation rules. Target, width, height and sample count are immediate setup parameters; set them before rendering. Construction does not spawn the light: call spawn() to add it to the scene.

Parameters:
  • height (width /) – Positive rectangle dimensions in world units. Each defaults to 2.

  • target – World point the rectangle faces. Defaults to the origin.

  • samples – Positive emitter sample count, rounded up to a square grid. Defaults to 4. More samples improve the single-sample renderer’s integration and shadows at linear cost. The path tracer samples the panel directly and its cost does not depend on this count.

  • distance (decay /) – Compatibility keywords fixed to 2 and 0 respectively, including on later assignment. Other values raise instead of silently changing emission to a distance-dependent, nonphysical model. Omit both in new code. Point and spot lights retain their artistic falloff controls.

Raises:

.AlganConfigurationError – If dimensions or sample count are invalid, or a nonphysical decay or finite distance cutoff is requested.

Methods

Attributes

animation_manager

This mob's scene-owned animation manager.

basis

The Mob's orientation and scale, as a flattened 3x3 matrix of shape (*, 9).

casts_shadows

Whether this Mob's geometry blocks light on its way from a light source to another surface -- whether it casts a shadow.

children

The Mobs attached below this one, in attachment order.

closed_shell

Whether this Mob's triangles form a CLOSED shell -- every camera ray that enters the geometry crosses a second time on its way out.

decay

The fixed inverse-square exponent, 2; this is not an animation.

distance

The fixed unlimited-range sentinel, 0; this is not an animation.

draws_descendants

Whether get_render_primitives returns geometry belonging to this Mob's DESCENDANTS as well as its own.

forward

Get the direction the Mob is facing.

lifespan

This mob's [spawn, despawn) interval on its Scene timeline (a Lifespan).

light_type

location

The Mob's position in world space, shape (*, 3).

normalized_basis

The Mob's orientation with scale divided out, shape (*, 9).

parents

The Mobs this one is attached to, in attachment order.

receives_shadows

Whether this Mob's surfaces are darkened by shadows cast onto them.

right

Get the Mob's own rightward direction.

scale_coefficient

The Mob's scale along its own right, up and forward axes, shape (*, 3).

two_sided

Whether this Mob's geometry should be lit from whichever side the ray arrives on.

up

Get the Mob's own upward direction.

x

The Mob's x coordinate in world units, shape (*, 1).

xy

The Mob's x and y coordinates in world units, shape (*, 2).

y

The Mob's y coordinate in world units, shape (*, 1).

z

The Mob's z coordinate in world units, shape (*, 1).

property decay: float

The fixed inverse-square exponent, 2; this is not an animation.

property distance: float

The fixed unlimited-range sentinel, 0; this is not an animation.