tune(shaders): more dramatic Phase 3a lighting contrast

Original Phase 3a constants had SUN_DIR=(0.4,0.3,0.8) — heavily
vertical, so roofs and ground both landed near peak brightness and
only walls dropped. Combined with AMBIENT=0.4/DIFFUSE=0.6 the lit-vs-
shadow contrast was ~2.2x, which was real but hard to read through
textures. User feedback: "Ligtning looks the same I think."

Diagnosed with a temporary grayscale-lighting fragment output — walls
on different sides of the same building did show different brightness,
confirming the Phase 3a/3b pipeline is wired correctly end-to-end and
the issue was purely perceptual contrast.

Retuned: SUN_DIR=(0.5,0.4,0.6) (more oblique), AMBIENT=0.25, DIFFUSE=0.75.
Contrast ratio now ~3.3x. User-verified visually.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-10 23:25:35 +02:00
parent 3c3f5267de
commit 89dc791510
2 changed files with 13 additions and 11 deletions

View file

@ -9,9 +9,13 @@ uniform sampler2D uDiffuse;
// gives scenery and building faces enough differentiation to read as 3D instead
// of looking like paper cutouts. Hardcoded for now; a later phase can route
// light parameters through uniforms driven by the game's time-of-day.
const vec3 SUN_DIR = normalize(vec3(0.4, 0.3, 0.8));
const float AMBIENT = 0.4;
const float DIFFUSE = 0.6;
// Sun direction tuned after Phase 3a verification: (0.4,0.3,0.8) was too
// vertical — roofs and ground both landed near peak brightness and only
// walls dropped, so the contrast was hard to read through textures. More
// oblique + lower ambient + higher diffuse = contrast ratio ~3.3x.
const vec3 SUN_DIR = normalize(vec3(0.5, 0.4, 0.6));
const float AMBIENT = 0.25;
const float DIFFUSE = 0.75;
void main() {
vec4 sampled = texture(uDiffuse, vTex);

View file

@ -6,14 +6,12 @@ out vec4 fragColor;
uniform sampler2DArray uAtlas;
// Phase 3a: shared lighting model with mesh.frag. Terrain normals are currently
// flat UnitZ (Phase 2b set this when building LandblockMesh vertices) so every
// terrain fragment gets the same ndotl contribution — terrain will look a bit
// flatter than hill-shaded terrain, which is a Phase 3b concern (compute
// per-vertex normals from the 9x9 heightmap to get relief lighting).
const vec3 SUN_DIR = normalize(vec3(0.4, 0.3, 0.8));
const float AMBIENT = 0.4;
const float DIFFUSE = 0.6;
// Shared lighting model with mesh.frag — must stay in sync. Phase 3b gave
// terrain real per-vertex normals via central differences on the heightmap,
// so hills catch and shade the sun just like static meshes do.
const vec3 SUN_DIR = normalize(vec3(0.5, 0.4, 0.6));
const float AMBIENT = 0.25;
const float DIFFUSE = 0.75;
void main() {
vec4 sampled = texture(uAtlas, vec3(vTex, float(vLayer)));