Fix per-vertex sunlight clamping (#9052)

Closes #9052 (closed)

Sunlight is handled and interpolated separately for shadowing, which can cause visual differences with clamped per-vertex lighting. Sunlight clamping occurs "per-fragment" so the game generally appears brighter than intended. Since we cannot and should not do per-vertex shadowing, @wareya proposed passing shaded and full lighting which are clamped and interpolated before the fragment shader gets to work with them. When the lighting is unclamped, there will be no visual difference, but when it is clamped, it should look closer to FFP/Morrowind, as seen on the screenshots.

Note this splits the vertex variant of doLighting into sun lighting and point lighting. Strictly speaking merging them back is possible, but would require more refactoring I'd like to do later on as it would touch more files, e.g., turning vertex colors and lighting components into structs and moving relevant multiplications into lighting.

Morrowind Снимок_экрана_в_2026-06-13_00-05-26 Снимок_экрана_в_2026-06-12_23-17-31
0.51.0 screenshot328 screenshot326
MR screenshot327 screenshot325

Merge request reports

Loading
Loading