polish(web): calmer stone texture + warm torchlight pooling

Renderer-only: low-frequency stone mottling (per ~4x4 block) with faint grain
instead of high-frequency per-cell noise; room glow now warms toward amber so
lit chambers read as torch-lit while corridors fall to shadow. Stronger
room/corridor light contrast.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Parley Hatch 2026-05-31 00:18:15 -06:00
parent a1d2a63937
commit d6dc354a1f

View file

@ -27,9 +27,9 @@ const PAL = {
// Lighting tunables (tweaked by eye via screenshots).
const LIGHT = {
ambient: 0.46, // floor brightness with no room glow
corridorFloor: 0.40, // ambient for cells in no room (corridors)
glow: 0.70, // peak extra brightness at a room's lit core
ambient: 0.44, // floor brightness with no room glow
corridorFloor: 0.36, // ambient for cells in no room (corridors)
glow: 0.78, // peak extra brightness at a room's lit core
aoFloor: 0.64, // brightness multiplier right next to a wall
aoDepth: 2.6, // cells from wall at which AO is fully open
maxB: 1.2, // clamp so highlights don't blow out
@ -154,11 +154,18 @@ export function renderMap(ctx, vw, vh, env, opts = {}) {
b = 0.85;
}
// Warm/cool stone variation + fine grain, from a stable hash.
const tint = 0.45 + 0.55 * hash2(x * 3 + 1, y * 7 + 2);
const grain = 0.9 + 0.2 * hash2(x, y);
const stone = lerp3(PAL.stoneCool, PAL.stoneWarm, tint);
ctx.fillStyle = rgb(scale3(stone, b * grain));
// Calm stone: low-frequency patches mottle warm↔cool (sampled per ~4×4
// block, not per cell, so it reads as stone rather than static), with a
// faint per-cell grain on top. Torchlight (room glow) warms the lit core.
const coarse = hash2((x >> 2) + 11, (y >> 2) + 7);
const grain = 0.93 + 0.09 * hash2(x, y);
const stone = lerp3(PAL.stoneCool, PAL.stoneWarm, 0.5 + 0.4 * coarse);
let col = scale3(stone, b * grain);
if (lit) {
const warm = glow[i] * 58; // torchlight pools warm in room cores
col = [col[0] + warm, col[1] + warm * 0.56, col[2] + warm * 0.12];
}
ctx.fillStyle = rgb(col);
ctx.fillRect(px(x), py(y), cell, cell);
// Shadow cast by a wall to the north, falling onto this floor cell.