Wall playground: controls and space

A patch of sunlight on a wall is the result of four separate roles: the sun determines the direction of the rays, an opening selects which rays pass, the wall receives them, and the camera observes the result. Keeping those roles separate makes the controls understandable: moving the sun can move the bright patch in the opposite direction, while moving the camera changes the view rather than the illumination.

The example here is a Three.js 0.186.0 prototype examined in September 2026. It contains a flat wall and a window-like shadow rig. Its dimensions are arbitrary scene units derived from the code, not measurements of a real room.

Follow a ray from the opening to the wall

The window rig sits in front of the receiving wall. Four broad blockers surround an opening, with optional crossbars. Their meshes cast shadows while deliberately skipping camera color and depth writes, so the window can affect the light without appearing as a visible object in the image. “Invisible” here describes a rendering choice; it does not mean the rig is necessarily outside the camera frame.

Use X to mean right, Y up and Z toward the viewer. The wall lies at z = 0; a point in the opening lies at (x, y, z) in front of it. Under the prototype's angle convention, the ray passing through that point reaches the wall at:

wallX = x − z × tan(direction)
wallY = y − z × tan(elevation) / cos(direction)

At the default settings, the opening center is (-4, 2.98, 4.8), the sun direction is −34° and the elevation is 27°. Its projected center is approximately (-0.762, 0.030, 0). Increasing the horizontal source direction generally moves the patch left: the direction toward the source and the direction in which light travels are opposite. Raising the sun moves the projection down through the fixed opening.

Parallel rays project this rectangular opening onto the flat wall as a parallelogram. An irregularly warped edge needs another explanation. Camera perspective can change the quadrilateral seen in an image without changing where the light falls; this prototype uses an orthographic camera, with parallel viewing rays and no perspective shrinkage.

The complete scene arrangement is:

  • Wall: centered at (0,0,0), 14 units wide and 10 high, facing +Z; one flat two-triangle plane.
  • Camera: (0,0,12), looking along −Z. Orthographic: parallel viewing rays, without perspective shrinkage. The viewport crops the wall; the camera does not orbit.
  • Window center: (-4 + horizontal, 2.98 + vertical, 4.8), turned −38° around Y. Four broad blockers surround an opening; optional bars divide it.
  • Sun: parallel directional rays from upper-left/front at the default angles. The model's light distance is not a physical sun distance.
  • Fill: a precomputed environment map made in a separate scene, supplying broad neutral illumination. No room-to-room light bounce simulation occurs.

What the controls change

An input event sends a patch to the shared state. The application updates material, light and window values and requests a render. A control therefore changes a specific model property; its numeric value is not necessarily a physical measurement. Reset lighting also resets the window, while reset material leaves lighting unchanged.

ControlDefault; rangeMeaning
Direction−34°; −65…40°Angle toward the sun horizontally; negative is left. Increasing generally moves its window footprint left.
Elevation27°; 5…55°Sun height angle; increasing moves the footprint down through the fixed opening.
Sunlight3; 0…6Relative direct-light intensity.
Fill light0.65; 0…2Environment intensity, including diffuse illumination and reflections.
Surface detailOnEnables both fine and broad surface-normal variation.
Paint finish0.78; 0.35…1Roughness: higher spreads reflections more broadly.
Fine texture40%; 0…100%Strength of small surface-normal variations.
Texture size1×; 0.5…2×Higher makes fine features larger; broad unevenness is unchanged.
Plaster unevenness30%; 0…100%Strength of broader normal variation.
Opening width/height2.8/3.1; each 1…4Dimensions in the tilted window plane, in arbitrary scene units.
Horizontal/vertical position0/0; −2…2 / −1.5…2World-axis offsets from the opening's starting position.
Window crossbarOnToggles both vertical and horizontal shadow-casting bars.

Surface detail stays attached to the wall. “Plaster unevenness” changes shading normals—the directions used in lighting calculations—without moving vertices or changing the silhouette and true geometric self-shadowing. It is also separate from photographic grain. The camera exposure and base gray remain fixed in this example. As in the triangle explanation, two flat triangles can support detailed pixel shading.

Distinguish projection from a shadow bug

In the captured prototype, Direction +20° and Elevation 27°, with other settings at their defaults, produced a broad bright area beyond an outer shadow edge. That area is a reproduced bug, not the intended window projection:

The window patch is partly visible at the left; the broad bright region beyond the diagonal outer edge is unintended light.

At those settings the relevant rays outside the opening still intersect the blockers, but some blockers fall outside the shadow camera's near clipping plane. Its position is only 15 × sunDirection, with a near distance of 0.1. The missing shadows expose direct light. At more extreme angles the finite surrounding panels also fail to cover all rays. Increasing only panel size or only the shadow camera's horizontal and vertical bounds would not address both causes. This account diagnoses the captured result; it does not claim a fix was implemented.

A patch moving offscreen, on the other hand, can be the expected geometric projection. It should not be confused with light leaking past a blocker that ought to cast a shadow.

A perpendicular-window thought experiment

To explore a more stretched patch, consider an alternative room with the window wall perpendicular to the receiving wall. This is illustrative geometry, not the inspected prototype's −38° rig. It uses a different, explicitly defined horizontal angle:

Let the receiving wall be z=0, the window wall x=0, and the room extend into positive X/Z. A window point (0,y,z) projects under parallel sunlight to:

x' = z × cot(θ)
y' = y − z × tan(elevation) / sin(θ)

Here θ is the horizontal ray angle toward the receiving wall, measured from +X. The opening's span along the room's depth becomes the patch's width. Its width multiplier is cot(θ): stretched below 45°, unchanged at 45°, compressed above 45°. Higher elevation increases downward slant. A rectangle still projects to a parallelogram on a flat wall.

Grazing sunlight spreads farther sideways but delivers less direct light per receiving area at unchanged source strength. Geometric stretching does not itself blur edges: a finite source produces penumbrae, whose extent depends on separation and projection. Photographic glow remains another mechanism.

Stretch, softness and glow remain separate controls. A finite light source creates a penumbra where only part of the source is visible. Optical scattering or bloom spreads bright image values. Increasing fill light does neither. The prototype's fixed shadow-map filter approximates soft edges, without fully simulating these effects. The lighting breakdown of Ida was a visual reference for exploring this direction, not evidence that the proposed room had been implemented.