mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-30 13:08:07 -06:00
dominant_direction weighted texels by their raw channel sum before the light's colour tinted the radiance, so equally bright red and blue regions on opposite sides cancelled to no sun and no key — while a red Environment light's tint removed the blue contribution and left the scene lit directionally red, with no shadow for its Cast Shadows to show. The tint now weights the direction sum (a white light weights [1; 3], a coloured one its normalised colour), so the sun and key are derived from the radiance the light actually emits; add_environment computes the tint once, before the direction pass, and reuses it for the texel tinting. An achromatic image is unaffected (its weights scale uniformly), so the default studio and white-lit scenes keep their shadows exactly. Tests: opposed red and blue texels cancel to a white light but a red tint points the sun straight at the red one (a blue tint, at the blue one); end to end, a red Environment light over an image with equally bright red and blue regions on exactly antipodal positions casts the shadow a white light over the same image does not — and the shadow falls opposite the red region, the side the tinted radiance comes from.