Strengthen nature tint and soft-blend across tiles.
Bilinear-sample the 16×16 noise in-shader so variation doesn’t show as hard tile squares, and widen cool/warm multipliers plus the tint slider range.
@@ -7,8 +7,8 @@ export const DEFAULT_NATURE_TINT = Object.freeze({
7
7
scale: 0.08,
8
8
/** 0..1 how hard to reshape noise around mid-grey. */
9
9
contrast: 1,
10
/** Warm/cool recolor strength. */
11
tint: 0.12,
10
/** Warm/cool recolor strength (0 = none, 1 = full cool↔warm). */
11
tint: 0.35,
12
12
/** Brightness variation strength. */
13
13
darken: 0.08
14
14
});
@@ -16,7 +16,7 @@ export const DEFAULT_NATURE_TINT = Object.freeze({
16
16
const SLIDERS = [
17
17
{ key: "scale", label: "Noise scale", min: 0.01, max: 0.4, step: 0.005 },
18
18
{ key: "contrast", label: "Contrast", min: 0.4, max: 2.5, step: 0.05 },
19
{ key: "tint", label: "Tint", min: 0, max: 0.45, step: 0.01 },
19
{ key: "tint", label: "Tint", min: 0, max: 1, step: 0.01 },
20
20
{ key: "darken", label: "Darken", min: 0, max: 0.4, step: 0.01 }
21
21
];
22
22
@@ -7,8 +7,8 @@ export const DEFAULT_NATURE_TINT = Object.freeze({7
scale: 0.08,7
scale: 0.08,8
/** 0..1 how hard to reshape noise around mid-grey. */8
/** 0..1 how hard to reshape noise around mid-grey. */9
contrast: 1,9
contrast: 1,10
/** Warm/cool recolor strength. */10
/** Warm/cool recolor strength (0 = none, 1 = full cool↔warm). */11
tint: 0.12,11
tint: 0.35,12
/** Brightness variation strength. */12
/** Brightness variation strength. */13
darken: 0.0813
darken: 0.0814
});14
});@@ -16,7 +16,7 @@ export const DEFAULT_NATURE_TINT = Object.freeze({16
const SLIDERS = [16
const SLIDERS = [17
{ key: "scale", label: "Noise scale", min: 0.01, max: 0.4, step: 0.005 },17
{ key: "scale", label: "Noise scale", min: 0.01, max: 0.4, step: 0.005 },18
{ key: "contrast", label: "Contrast", min: 0.4, max: 2.5, step: 0.05 },18
{ key: "contrast", label: "Contrast", min: 0.4, max: 2.5, step: 0.05 },19
{ key: "tint", label: "Tint", min: 0, max: 0.45, step: 0.01 },19
{ key: "tint", label: "Tint", min: 0, max: 1, step: 0.01 },20
{ key: "darken", label: "Darken", min: 0, max: 0.4, step: 0.01 }20
{ key: "darken", label: "Darken", min: 0, max: 0.4, step: 0.01 }21
];21
];22
22
@@ -889,16 +889,30 @@ const ATLAS_LIGHTING_FRAG = [
889
889
" if (color.a <= 0.0) { discard; }",
890
890
" vec3 rgb = color.rgb;",
891
891
" if (u_useNature > 0.5) {",
892
" vec2 tileUv = (floor(v_texCoord * 16.0) + 0.5) / 16.0;",
893
" vec4 nature = texture2D(u_bump, tileUv);",
894
" if (nature.a > 0.5) {",
895
" float n = clamp((nature.r - 0.5) * max(u_natureContrast, 0.01) + 0.5, 0.0, 1.0);",
892
// Soft bilinear over the 16×16 noise (textures are NEAREST globally).
893
" vec2 texel = v_texCoord * 16.0 - 0.5;",
894
" vec2 i0 = floor(texel);",
895
" vec2 f = fract(texel);",
896
" vec2 i1 = i0 + 1.0;",
897
" vec2 c00 = (clamp(i0, 0.0, 15.0) + 0.5) / 16.0;",
898
" vec2 c10 = (clamp(vec2(i1.x, i0.y), 0.0, 15.0) + 0.5) / 16.0;",
899
" vec2 c01 = (clamp(vec2(i0.x, i1.y), 0.0, 15.0) + 0.5) / 16.0;",
900
" vec2 c11 = (clamp(i1, 0.0, 15.0) + 0.5) / 16.0;",
901
" vec4 s00 = texture2D(u_bump, c00);",
902
" vec4 s10 = texture2D(u_bump, c10);",
903
" vec4 s01 = texture2D(u_bump, c01);",
904
" vec4 s11 = texture2D(u_bump, c11);",
905
" float nRaw = mix(mix(s00.r, s10.r, f.x), mix(s01.r, s11.r, f.x), f.y);",
906
" float a = mix(mix(s00.a, s10.a, f.x), mix(s01.a, s11.a, f.x), f.y);",
907
" if (a > 0.01) {",
908
" float n = clamp((nRaw - 0.5) * max(u_natureContrast, 0.01) + 0.5, 0.0, 1.0);",
896
909
" float c = (n - 0.5) * 2.0;",
897
" rgb *= 1.0 - c * u_natureDark;",
898
" vec3 cool = vec3(0.92, 1.03, 0.97);",
899
" vec3 warm = vec3(1.07, 1.02, 0.90);",
910
" vec3 tinted = rgb * (1.0 - c * u_natureDark);",
911
" vec3 cool = vec3(0.72, 1.14, 1.08);",
912
" vec3 warm = vec3(1.28, 1.06, 0.68);",
900
913
" vec3 tint = mix(cool, warm, n);",
901
" rgb *= mix(vec3(1.0), tint, clamp(u_natureTint, 0.0, 1.0));",
914
" tinted *= mix(vec3(1.0), tint, clamp(u_natureTint, 0.0, 1.0));",
915
" rgb = mix(rgb, tinted, clamp(a, 0.0, 1.0));",
902
916
" }",
903
917
" }",
904
918
" vec2 lightUV = v_texCoord;",
@@ -889,16 +889,30 @@ const ATLAS_LIGHTING_FRAG = [889
" if (color.a <= 0.0) { discard; }",889
" if (color.a <= 0.0) { discard; }",890
" vec3 rgb = color.rgb;",890
" vec3 rgb = color.rgb;",891
" if (u_useNature > 0.5) {",891
" if (u_useNature > 0.5) {",892
" vec2 tileUv = (floor(v_texCoord * 16.0) + 0.5) / 16.0;",892
// Soft bilinear over the 16×16 noise (textures are NEAREST globally).893
" vec4 nature = texture2D(u_bump, tileUv);",893
" vec2 texel = v_texCoord * 16.0 - 0.5;",894
" if (nature.a > 0.5) {",894
" vec2 i0 = floor(texel);",895
" float n = clamp((nature.r - 0.5) * max(u_natureContrast, 0.01) + 0.5, 0.0, 1.0);",895
" vec2 f = fract(texel);",896
" vec2 i1 = i0 + 1.0;",897
" vec2 c00 = (clamp(i0, 0.0, 15.0) + 0.5) / 16.0;",898
" vec2 c10 = (clamp(vec2(i1.x, i0.y), 0.0, 15.0) + 0.5) / 16.0;",899
" vec2 c01 = (clamp(vec2(i0.x, i1.y), 0.0, 15.0) + 0.5) / 16.0;",900
" vec2 c11 = (clamp(i1, 0.0, 15.0) + 0.5) / 16.0;",901
" vec4 s00 = texture2D(u_bump, c00);",902
" vec4 s10 = texture2D(u_bump, c10);",903
" vec4 s01 = texture2D(u_bump, c01);",904
" vec4 s11 = texture2D(u_bump, c11);",905
" float nRaw = mix(mix(s00.r, s10.r, f.x), mix(s01.r, s11.r, f.x), f.y);",906
" float a = mix(mix(s00.a, s10.a, f.x), mix(s01.a, s11.a, f.x), f.y);",907
" if (a > 0.01) {",908
" float n = clamp((nRaw - 0.5) * max(u_natureContrast, 0.01) + 0.5, 0.0, 1.0);",896
" float c = (n - 0.5) * 2.0;",909
" float c = (n - 0.5) * 2.0;",897
" rgb *= 1.0 - c * u_natureDark;",910
" vec3 tinted = rgb * (1.0 - c * u_natureDark);",898
" vec3 cool = vec3(0.92, 1.03, 0.97);",911
" vec3 cool = vec3(0.72, 1.14, 1.08);",899
" vec3 warm = vec3(1.07, 1.02, 0.90);",912
" vec3 warm = vec3(1.28, 1.06, 0.68);",900
" vec3 tint = mix(cool, warm, n);",913
" vec3 tint = mix(cool, warm, n);",901
" rgb *= mix(vec3(1.0), tint, clamp(u_natureTint, 0.0, 1.0));",914
" tinted *= mix(vec3(1.0), tint, clamp(u_natureTint, 0.0, 1.0));",915
" rgb = mix(rgb, tinted, clamp(a, 0.0, 1.0));",902
" }",916
" }",903
" }",917
" }",904
" vec2 lightUV = v_texCoord;",918
" vec2 lightUV = v_texCoord;",