BlueGit

timfa questward

Tighten cliff magenta detect so ebony wood stays opaque.

Block atlas ground-top shader treated any R≈B fill as cliff magenta. Ebony’s tint is near-neutral purple, so tables/walls/fences were replaced with the ground sample and looked hollow.

timfa Tim Falken · pushed by timfa

Authored 2026-08-31 · 2 months ago

Hash
45fd07f77a67b09991dd4f0ec95838108ee4fecc
Parent
499d7850
1 file changed +9 −6
client/src/render/worldView.js +9 −6
@@ -354,10 +354,12 @@ const ATLAS_LIGHTING_FRAG = [
354 354 ].join("\n");
355 355
356 356 /**
357 * Block-row atlas: magenta → sample the ground atlas (u_bump) at the same
358 * tile-local UV (1:1 scale). The ground atlas already includes soft-terrain
359 * blending when that preference is on, so cliff tops match the floor beneath.
360 * Darkness matches ATLAS_LIGHTING_FRAG (lightmap in u_secondary).
357 * Block-row atlas: high-chroma magenta → sample the ground atlas (u_bump) at the
358 * same tile-local UV (1:1 scale). Used for cliff tops. Detection requires a real
359 * magenta mask (R≈B and R−G large); dark near-neutral tints like ebony wood also
360 * have R≈B after catalog tint and must not be treated as cliff magenta.
361 * The ground atlas already includes soft-terrain blending when that preference
362 * is on. Darkness matches ATLAS_LIGHTING_FRAG (lightmap in u_secondary).
361 363 */
362 364 const ATLAS_BLOCK_GROUND_TOP_FRAG = [
363 365 "precision mediump float;",
@@ -372,9 +374,10 @@ const ATLAS_BLOCK_GROUND_TOP_FRAG = [
372 374 " vec4 color = texture2D(u_texture, v_texCoord);",
373 375 " if (color.a <= 0.0) { discard; }",
374 376 " vec3 rgb = color.rgb;",
375 " // Magenta family (R≈B, G<R): replace with blended ground under this pixel.",
377 " // Authored magenta masks only (cliff tops). Not post-tint ebony etc.",
376 378 " float rbDiff = abs(rgb.r - rgb.b);",
377 " if (rbDiff < 0.02 && rgb.g < rgb.r - 0.02) {",
379 " float magentaChroma = rgb.r - rgb.g;",
380 " if (rbDiff < 0.02 && magentaChroma > 0.15) {",
378 381 " float tileX = floor(v_texCoord.x * 16.0);",
379 382 " float tileY = max(u_lightRow, 0.0);",
380 383 " float localX = fract(v_texCoord.x * 16.0);",
@@ -354,10 +354,12 @@ const ATLAS_LIGHTING_FRAG = [
354].join("\n");
354].join("\n");
355
355
356/**
356/**
357 * Block-row atlas: magenta → sample the ground atlas (u_bump) at the same
357 * Block-row atlas: high-chroma magenta → sample the ground atlas (u_bump) at the
358 * tile-local UV (1:1 scale). The ground atlas already includes soft-terrain
358 * same tile-local UV (1:1 scale). Used for cliff tops. Detection requires a real
359 * blending when that preference is on, so cliff tops match the floor beneath.
359 * magenta mask (R≈B and R−G large); dark near-neutral tints like ebony wood also
360 * Darkness matches ATLAS_LIGHTING_FRAG (lightmap in u_secondary).
360 * have R≈B after catalog tint and must not be treated as cliff magenta.
361 * The ground atlas already includes soft-terrain blending when that preference
362 * is on. Darkness matches ATLAS_LIGHTING_FRAG (lightmap in u_secondary).
361 */
363 */
362const ATLAS_BLOCK_GROUND_TOP_FRAG = [
364const ATLAS_BLOCK_GROUND_TOP_FRAG = [
363 "precision mediump float;",
365 "precision mediump float;",
@@ -372,9 +374,10 @@ const ATLAS_BLOCK_GROUND_TOP_FRAG = [
372 " vec4 color = texture2D(u_texture, v_texCoord);",
374 " vec4 color = texture2D(u_texture, v_texCoord);",
373 " if (color.a <= 0.0) { discard; }",
375 " if (color.a <= 0.0) { discard; }",
374 " vec3 rgb = color.rgb;",
376 " vec3 rgb = color.rgb;",
375 " // Magenta family (R≈B, G<R): replace with blended ground under this pixel.",
377 " // Authored magenta masks only (cliff tops). Not post-tint ebony etc.",
376 " float rbDiff = abs(rgb.r - rgb.b);",
378 " float rbDiff = abs(rgb.r - rgb.b);",
377 " if (rbDiff < 0.02 && rgb.g < rgb.r - 0.02) {",
379 " float magentaChroma = rgb.r - rgb.g;",
380 " if (rbDiff < 0.02 && magentaChroma > 0.15) {",
378 " float tileX = floor(v_texCoord.x * 16.0);",
381 " float tileX = floor(v_texCoord.x * 16.0);",
379 " float tileY = max(u_lightRow, 0.0);",
382 " float tileY = max(u_lightRow, 0.0);",
380 " float localX = fract(v_texCoord.x * 16.0);",
383 " float localX = fract(v_texCoord.x * 16.0);",