Review fixes: a failed environment source lights nothing (#2436)

Two review points on the merge:

- env_pixels returned None both for an unconfigured light (no Source, no
  Environment Layer) and for a failed source (a deleted layer, missing
  footage, a failed decode), so a selected source that failed silently
  swapped in the default studio environment — relighting and reshadowing
  the scene behind the user's back. It now tells the three apart
  (EnvPixels::Absent/Image/Failed): only the unconfigured light uses the
  default; a failed source contributes nothing, exactly like a layer whose
  source fails renders nothing. The repair the user can act on stays where
  it already lives — missing footage is flagged on the item, with the
  relink commands to fix it.

- The docs claimed only a uniform image casts no shadow. A non-uniform one
  can be directionless too: opposing bright regions cancel, and anything
  under 1% directional is rejected. agents.md, architecture.md and the
  sun/dominant_direction doc comments now say an image without a
  sufficiently strong dominant direction.

Tests: an unreadable Environment Layer (auto-picked), an unreadable
selected Source and a deleted one all light nothing — pixel-equal to the
unlit render, no studio default, no default-environment shadow — while an
unconfigured light still lights; two equal bright spots at opposite
azimuths cancel to no sun and no key, and tilting the balance re-emerges
pointing at the brighter spot.
This commit is contained in:
Z User
2026-10-27 12:33:46 +00:00
parent 978ca419b9
commit eb34d10d21
4 changed files with 141 additions and 19 deletions
+8 -5
View File
@@ -215,12 +215,15 @@ Things that tripped up a long agent-driven session (a multi-scene 3D piece built
layer by layer id; with no source it uses the comp's Environment Layer (`layer.environment`),
or a default studio environment — bright above and toward the initial camera, dark below and
behind, at a dim 0.3 mean level — of the light's colour × intensity when there is none; either
way the light brightens the scene. It has `castsShadows`/`shadowDarkness`/`shadowDiffusion`
way the light brightens the scene. A selected Source or Environment Layer that fails to
render — a deleted layer, missing footage — lights nothing instead: the light never silently
falls back to the studio default. It has `castsShadows`/`shadowDarkness`/`shadowDiffusion`
like the other lights: Cast Shadows shades the scene from the image's dominant bright region
(the default environment's key, or a source image's brightest area; only a uniform image has
none, so it casts no shadow) — occluding only that key's share of the light, so the shadow
stays partial like After Effects' area-light shadows, and soft by default (a penumbra of at
least 8 pixels or four map texels, plus Shadow Diffusion). It only lights
(the default environment's key, or a source image's brightest area; an image without a
sufficiently strong dominant direction has none — a uniform one, or opposing bright regions
that cancel — so it casts no shadow) — occluding only that key's share of the light, so the
shadow stays partial like After Effects' area-light shadows, and soft by default (a penumbra
of at least 8 pixels or four map texels, plus Shadow Diffusion). It only lights
Advanced 3D comps, so creating one (or changing a light's type to Environment) switches a
Classic 3D comp to Advanced 3D
([#261](https://github.com/storytold/effectcraft/issues/261),