BlueGit

timfa questward

Spill 3×3 dynamic lights (incl. torches) onto the outer baked lightmap.

Outer chunks already max(baked, dynamic); including inner block lights removes the dark seam where atlas halo tiles sit in the active region.

timfa Tim Falken · pushed by timfa

Authored 2026-09-02 · 2 months ago

Hash
85950896080acbfaf3298d8d98fa15771a5ec973
Parent
06b69a70
1 file changed +6 −4
client/src/render/worldView.js +6 −4
@@ -3966,7 +3966,8 @@ export class WorldView
3966 3966 /**
3967 3967 * Lights to simulate for one chunk.
3968 3968 * Inner 3×3: mobile lights from the inner region + authored block lights that reach the chunk.
3969 * Outer ring: only mobile lights originating inside the 3×3 that reach the chunk (baked fills the rest).
3969 * Outer ring: baked base + spill from any dynamic source that originates inside the 3×3
3970 * (lanterns, spells, and torches) so the boundary stays seamless.
3970 3971 */
3971 3972 #dynamicLightsForChunk (chunkX, chunkY, mobileLights, blockLights = [])
3972 3973 {
@@ -3979,8 +3980,8 @@ export class WorldView
3979 3980 const blocks = blockLights.filter((light) => this.#lightAffectsChunkBounds(light, chunkX, chunkY));
3980 3981 return [...inner, ...blocks];
3981 3982 }
3982 const inner = this.#innerDynamicLights(mobileLights);
3983 return inner.filter((light) => this.#lightAffectsChunkBounds(light, chunkX, chunkY));
3983 const spill = this.#innerDynamicLights([...mobileLights, ...blockLights]);
3984 return spill.filter((light) => this.#lightAffectsChunkBounds(light, chunkX, chunkY));
3984 3985 }
3985 3986
3986 3987 #dynamicLightsForTile (tileX, tileY, mobileLights, blockLights = [])
@@ -4338,7 +4339,8 @@ export class WorldView
4338 4339 if (!snapshot?.light)
4339 4340 { return null; }
4340 4341 const bakedHash = this.#hashUint8Array(snapshot.light);
4341 const lights = this.#dynamicLightsForChunk(baked.chunkX, baked.chunkY, activeLights);
4342 // Caller already scoped lights for this chunk (incl. 3×3 spill onto the outer ring).
4343 const lights = activeLights;
4342 4344 const darks = this._activeSpellDarks ?? [];
4343 4345 const mode = this.lightingMode === "simple" ? "s" : "f";
4344 4346 const ambientKey = Math.round(Math.max(0, ambientDark) * 1000);
@@ -3966,7 +3966,8 @@ export class WorldView
3966 /**
3966 /**
3967 * Lights to simulate for one chunk.
3967 * Lights to simulate for one chunk.
3968 * Inner 3×3: mobile lights from the inner region + authored block lights that reach the chunk.
3968 * Inner 3×3: mobile lights from the inner region + authored block lights that reach the chunk.
3969 * Outer ring: only mobile lights originating inside the 3×3 that reach the chunk (baked fills the rest).
3969 * Outer ring: baked base + spill from any dynamic source that originates inside the 3×3
3970 * (lanterns, spells, and torches) so the boundary stays seamless.
3970 */
3971 */
3971 #dynamicLightsForChunk (chunkX, chunkY, mobileLights, blockLights = [])
3972 #dynamicLightsForChunk (chunkX, chunkY, mobileLights, blockLights = [])
3972 {
3973 {
@@ -3979,8 +3980,8 @@ export class WorldView
3979 const blocks = blockLights.filter((light) => this.#lightAffectsChunkBounds(light, chunkX, chunkY));
3980 const blocks = blockLights.filter((light) => this.#lightAffectsChunkBounds(light, chunkX, chunkY));
3980 return [...inner, ...blocks];
3981 return [...inner, ...blocks];
3981 }
3982 }
3982 const inner = this.#innerDynamicLights(mobileLights);
3983 const spill = this.#innerDynamicLights([...mobileLights, ...blockLights]);
3983 return inner.filter((light) => this.#lightAffectsChunkBounds(light, chunkX, chunkY));
3984 return spill.filter((light) => this.#lightAffectsChunkBounds(light, chunkX, chunkY));
3984 }
3985 }
3985
3986
3986 #dynamicLightsForTile (tileX, tileY, mobileLights, blockLights = [])
3987 #dynamicLightsForTile (tileX, tileY, mobileLights, blockLights = [])
@@ -4338,7 +4339,8 @@ export class WorldView
4338 if (!snapshot?.light)
4339 if (!snapshot?.light)
4339 { return null; }
4340 { return null; }
4340 const bakedHash = this.#hashUint8Array(snapshot.light);
4341 const bakedHash = this.#hashUint8Array(snapshot.light);
4341 const lights = this.#dynamicLightsForChunk(baked.chunkX, baked.chunkY, activeLights);
4342 // Caller already scoped lights for this chunk (incl. 3×3 spill onto the outer ring).
4343 const lights = activeLights;
4342 const darks = this._activeSpellDarks ?? [];
4344 const darks = this._activeSpellDarks ?? [];
4343 const mode = this.lightingMode === "simple" ? "s" : "f";
4345 const mode = this.lightingMode === "simple" ? "s" : "f";
4344 const ambientKey = Math.round(Math.max(0, ambientDark) * 1000);
4346 const ambientKey = Math.round(Math.max(0, ambientDark) * 1000);