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:
parent
a1d2a63937
commit
d6dc354a1f
1 changed files with 15 additions and 8 deletions
|
|
@ -27,9 +27,9 @@ const PAL = {
|
||||||
|
|
||||||
// Lighting tunables (tweaked by eye via screenshots).
|
// Lighting tunables (tweaked by eye via screenshots).
|
||||||
const LIGHT = {
|
const LIGHT = {
|
||||||
ambient: 0.46, // floor brightness with no room glow
|
ambient: 0.44, // floor brightness with no room glow
|
||||||
corridorFloor: 0.40, // ambient for cells in no room (corridors)
|
corridorFloor: 0.36, // ambient for cells in no room (corridors)
|
||||||
glow: 0.70, // peak extra brightness at a room's lit core
|
glow: 0.78, // peak extra brightness at a room's lit core
|
||||||
aoFloor: 0.64, // brightness multiplier right next to a wall
|
aoFloor: 0.64, // brightness multiplier right next to a wall
|
||||||
aoDepth: 2.6, // cells from wall at which AO is fully open
|
aoDepth: 2.6, // cells from wall at which AO is fully open
|
||||||
maxB: 1.2, // clamp so highlights don't blow out
|
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;
|
b = 0.85;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm/cool stone variation + fine grain, from a stable hash.
|
// Calm stone: low-frequency patches mottle warm↔cool (sampled per ~4×4
|
||||||
const tint = 0.45 + 0.55 * hash2(x * 3 + 1, y * 7 + 2);
|
// block, not per cell, so it reads as stone rather than static), with a
|
||||||
const grain = 0.9 + 0.2 * hash2(x, y);
|
// faint per-cell grain on top. Torchlight (room glow) warms the lit core.
|
||||||
const stone = lerp3(PAL.stoneCool, PAL.stoneWarm, tint);
|
const coarse = hash2((x >> 2) + 11, (y >> 2) + 7);
|
||||||
ctx.fillStyle = rgb(scale3(stone, b * grain));
|
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);
|
ctx.fillRect(px(x), py(y), cell, cell);
|
||||||
|
|
||||||
// Shadow cast by a wall to the north, falling onto this floor cell.
|
// Shadow cast by a wall to the north, falling onto this floor cell.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue