acdream/src/AcDream.Core/Lighting
Erik 57c2ab735d fix(lighting): #143 — dynamic lights use retail's D3D 1/d attenuation (portal + viewer spread)
The portal swirl's magenta light (and the viewer fill) read as a tight,
concentrated pool vs retail's soft, room-wide tint. Cause: acdream applied its
STATIC dat-bake falloff (1/d^3 distance-cube + range x1.3) to ALL point lights,
including dynamic ones. Retail draws dynamic lights through the D3D hardware
path (config_hardware_light 0x0059ad30): a point light gets Attenuation1=1 =>
att = 1/d (inverse-linear), plain Lambert, range x1.5 (rangeAdjust 0x00820cc4).

Split the two paths by a per-light IsDynamic flag:
- LightSource.IsDynamic; packed into GlobalLight.coneAngleEtc.y (binding=4).
- LightInfoLoader.Load(isDynamic) => range x1.5 + flag (server-object/portal
  lights via the live spawn path); dat-static lights keep x1.3 (default).
- Viewer fill + weenie/portal lights = dynamic; dat torches = static.
- mesh_modern.vert pointContribution: dynamic branch = 1/d att, plain Lambert,
  hard cutoff, no per-light cap (D3D accumulates then saturates via the existing
  min(pointAcc,1)); static branch = the unchanged wrap/norm bake.

This is the portal half of #143 (the magenta light itself now registers + reaches
the walls via the prior weenie-light + landblock-key fix). Refines AP-35: point
lights now split static-bake (1/d^3) vs dynamic-hardware (1/d) by path.

Verified: portal light now range=9 (6x1.5), magenta spreads softly; shader
compiles clean; static torches unchanged (range 5.2/6.5/7.8). User-confirmed the
portal matches retail and the torch-lit interior did not over-brighten.
Core lighting 44/44, App 476 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20 18:14:57 +02:00
..
GlobalLightPacker.cs fix(lighting): #143 — dynamic lights use retail's D3D 1/d attenuation (portal + viewer spread) 2026-06-20 18:14:57 +02:00
LightBake.cs feat(A7): LightBake Core — verified per-vertex static-light burn-in (foundation, not wired) 2026-06-14 14:27:45 +02:00
LightInfoLoader.cs fix(lighting): #143 — dynamic lights use retail's D3D 1/d attenuation (portal + viewer spread) 2026-06-20 18:14:57 +02:00
LightingHookSink.cs feat(lighting): Phase G.2 — Setup.Lights + SetLightHook wiring 2026-04-19 10:46:49 +02:00
LightManager.cs fix(lighting): #143 — dynamic lights use retail's D3D 1/d attenuation (portal + viewer spread) 2026-06-20 18:14:57 +02:00
LightSource.cs fix(lighting): #143 — dynamic lights use retail's D3D 1/d attenuation (portal + viewer spread) 2026-06-20 18:14:57 +02:00
SceneLightingUbo.cs feat(render): Phase G.1/G.2 — SceneLighting UBO + sky renderer + shader integration 2026-04-19 10:39:48 +02:00