wip: uncommitted work gathered before the branch is merged into main

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-30 17:18:48 +03:00
parent cc384efee0
commit 737d6e1859
30 changed files with 307 additions and 120 deletions

View file

@ -84,7 +84,7 @@ vec3 bladeField(vec2 xz, float y) {
// dry and green patches a few metres across, and the tussocks' own shade of the same green
float dryp = smoothstep(0.2, 0.8, gnoise(xz * 0.33 + 17.0) * 0.5 + 0.5);
t *= mix(vec3(0.92, 1.0, 0.95), vec3(1.30, 1.10, 0.62), dryp);
return t * (0.72 + 0.56 * (gnoise(xz * 1.9 + 41.0) * 0.5 + 0.5));
return t * (0.55 + 0.80 * (gnoise(xz * 1.9 + 41.0) * 0.5 + 0.5));
}
void main() {

View file

@ -61,7 +61,7 @@ vec3 bladeField(vec2 xz, float y) {
t *= mix(vec3(0.7, 0.8, 0.55), vec3(1.1, 1.05, 0.85), patchy);
float dryp = smoothstep(0.2, 0.8, gnoise(xz * 0.33 + 17.0) * 0.5 + 0.5);
t *= mix(vec3(0.92, 1.0, 0.95), vec3(1.30, 1.10, 0.62), dryp);
return t * (0.72 + 0.56 * (gnoise(xz * 1.9 + 41.0) * 0.5 + 0.5));
return t * (0.55 + 0.80 * (gnoise(xz * 1.9 + 41.0) * 0.5 + 0.5));
}
void main() {
@ -118,6 +118,13 @@ void main() {
uint o = (pr.base[b] + slot) * 4u;
outv[o] = vec4(xz.x, h - 0.02, xz.y, seed);
outv[o + 1u] = vec4(sin(ang), cos(ang), tall, bw);
outv[o + 2u] = vec4(bladeField(xz, h), 0.6 + 0.8 * h4);
// each blade its own: a hue a little toward olive or toward blue-green, and in a dry patch more
// of them gone to straw - a meadow is mixed blade by blade, not tinted as one
vec3 field = bladeField(xz, h);
float hj = bladeHash(ci, j, 7) - 0.5;
field *= vec3(1.0 + 0.30 * hj, 1.0, 1.0 - 0.30 * hj);
float dryp = smoothstep(0.2, 0.8, gnoise(xz * 0.33 + 17.0) * 0.5 + 0.5);
if (bladeHash(ci, j, 8) < 0.10 + 0.45 * dryp) field *= vec3(1.45, 1.18, 0.52);
outv[o + 2u] = vec4(field, 0.6 + 0.8 * h4);
outv[o + 3u] = vec4(gn, dist);
}

View file

@ -142,7 +142,9 @@ void main() {
// an occlusion term; grass albedo is capped near 0.5 and this was dividing it by five.
// A blade is a thin thing standing in open air: shaded at the root by its neighbours,
// not buried.
arm = vec3(mix(0.55, 1.0, t), 0.85, 0.0);
// the inside of a sward is its own shade: a blade's base sits among its neighbours (the old clumps
// got this from the shadow maps, at 4.5 ms; seen from above it is most of a meadow's texture)
arm = vec3(mix(0.30, 1.0, smoothstep(0.0, 0.8, t)), 0.85, 0.0);
#elif defined(CARD)
// thin grass is lit from either side: face the card toward the sun before shading
if (dot(N, u_sun_dir) < 0.0) N = -N;

View file

@ -2996,10 +2996,11 @@ U 2e2908c8 frag u_half 828 float 1 0
U 2e2908c8 frag u_texel 832 float 1 0
U 2e2908c8 frag u_ortho_on 836 float 1 0
U 2e2908c8 frag u_carpet_on 840 float 1 0
U 2e2908c8 frag u_snow_line 844 float 1 0
U 2e2908c8 frag u_lake_level 848 float 1 0
U 2e2908c8 frag u_wet 852 float 1 0
U 2e2908c8 frag u_sea_level 856 float 1 0
U 2e2908c8 frag u_grass_reach 844 float 1 0
U 2e2908c8 frag u_snow_line 848 float 1 0
U 2e2908c8 frag u_lake_level 852 float 1 0
U 2e2908c8 frag u_wet 856 float 1 0
U 2e2908c8 frag u_sea_level 860 float 1 0
U 2e2908c8 frag u_lake 864 vec4 1 0
U 2e2908c8 frag u_origin 880 vec2 1 0
U 2e2908c8 frag u_view 896 mat4 1 0
@ -3073,10 +3074,11 @@ U 1f95f31b frag u_half 828 float 1 0
U 1f95f31b frag u_texel 832 float 1 0
U 1f95f31b frag u_ortho_on 836 float 1 0
U 1f95f31b frag u_carpet_on 840 float 1 0
U 1f95f31b frag u_snow_line 844 float 1 0
U 1f95f31b frag u_lake_level 848 float 1 0
U 1f95f31b frag u_wet 852 float 1 0
U 1f95f31b frag u_sea_level 856 float 1 0
U 1f95f31b frag u_grass_reach 844 float 1 0
U 1f95f31b frag u_snow_line 848 float 1 0
U 1f95f31b frag u_lake_level 852 float 1 0
U 1f95f31b frag u_wet 856 float 1 0
U 1f95f31b frag u_sea_level 860 float 1 0
U 1f95f31b frag u_lake 864 vec4 1 0
U 1f95f31b frag u_origin 880 vec2 1 0
U 1f95f31b frag u_view 896 mat4 1 0
@ -3150,10 +3152,11 @@ U f4382918 frag u_half 828 float 1 0
U f4382918 frag u_texel 832 float 1 0
U f4382918 frag u_ortho_on 836 float 1 0
U f4382918 frag u_carpet_on 840 float 1 0
U f4382918 frag u_snow_line 844 float 1 0
U f4382918 frag u_lake_level 848 float 1 0
U f4382918 frag u_wet 852 float 1 0
U f4382918 frag u_sea_level 856 float 1 0
U f4382918 frag u_grass_reach 844 float 1 0
U f4382918 frag u_snow_line 848 float 1 0
U f4382918 frag u_lake_level 852 float 1 0
U f4382918 frag u_wet 856 float 1 0
U f4382918 frag u_sea_level 860 float 1 0
U f4382918 frag u_lake 864 vec4 1 0
U f4382918 frag u_origin 880 vec2 1 0
U f4382918 frag u_view 896 mat4 1 0
@ -3227,10 +3230,11 @@ U f2952361 frag u_half 828 float 1 0
U f2952361 frag u_texel 832 float 1 0
U f2952361 frag u_ortho_on 836 float 1 0
U f2952361 frag u_carpet_on 840 float 1 0
U f2952361 frag u_snow_line 844 float 1 0
U f2952361 frag u_lake_level 848 float 1 0
U f2952361 frag u_wet 852 float 1 0
U f2952361 frag u_sea_level 856 float 1 0
U f2952361 frag u_grass_reach 844 float 1 0
U f2952361 frag u_snow_line 848 float 1 0
U f2952361 frag u_lake_level 852 float 1 0
U f2952361 frag u_wet 856 float 1 0
U f2952361 frag u_sea_level 860 float 1 0
U f2952361 frag u_lake 864 vec4 1 0
U f2952361 frag u_origin 880 vec2 1 0
U f2952361 frag u_view 896 mat4 1 0
@ -3304,10 +3308,11 @@ U a0f2dbac frag u_half 828 float 1 0
U a0f2dbac frag u_texel 832 float 1 0
U a0f2dbac frag u_ortho_on 836 float 1 0
U a0f2dbac frag u_carpet_on 840 float 1 0
U a0f2dbac frag u_snow_line 844 float 1 0
U a0f2dbac frag u_lake_level 848 float 1 0
U a0f2dbac frag u_wet 852 float 1 0
U a0f2dbac frag u_sea_level 856 float 1 0
U a0f2dbac frag u_grass_reach 844 float 1 0
U a0f2dbac frag u_snow_line 848 float 1 0
U a0f2dbac frag u_lake_level 852 float 1 0
U a0f2dbac frag u_wet 856 float 1 0
U a0f2dbac frag u_sea_level 860 float 1 0
U a0f2dbac frag u_lake 864 vec4 1 0
U a0f2dbac frag u_origin 880 vec2 1 0
U a0f2dbac frag u_view 896 mat4 1 0
@ -3381,10 +3386,11 @@ U 5e4589a1 frag u_half 828 float 1 0
U 5e4589a1 frag u_texel 832 float 1 0
U 5e4589a1 frag u_ortho_on 836 float 1 0
U 5e4589a1 frag u_carpet_on 840 float 1 0
U 5e4589a1 frag u_snow_line 844 float 1 0
U 5e4589a1 frag u_lake_level 848 float 1 0
U 5e4589a1 frag u_wet 852 float 1 0
U 5e4589a1 frag u_sea_level 856 float 1 0
U 5e4589a1 frag u_grass_reach 844 float 1 0
U 5e4589a1 frag u_snow_line 848 float 1 0
U 5e4589a1 frag u_lake_level 852 float 1 0
U 5e4589a1 frag u_wet 856 float 1 0
U 5e4589a1 frag u_sea_level 860 float 1 0
U 5e4589a1 frag u_lake 864 vec4 1 0
U 5e4589a1 frag u_origin 880 vec2 1 0
U 5e4589a1 frag u_view 896 mat4 1 0

View file

@ -16,6 +16,7 @@ uniform float u_ortho_on;
uniform sampler2D u_rock_d; uniform sampler2D u_rock_n; uniform sampler2D u_rock_a;
uniform sampler2D u_snow_d; uniform sampler2D u_carpet; // the clump cards baked straight down (alpha = coverage)
uniform float u_carpet_on;
uniform float u_grass_reach; // where the GPU blades stop (0: none): the ground under them is in their shade
uniform float u_snow_line;
uniform float u_lake_level; // the ground just above the water is wet and dark
// ---- RAIN THAT LEAVES SOMETHING BEHIND -----------------------------------------------------
@ -339,6 +340,18 @@ vec3 groundShade(vec3 p, vec3 N, float slope, float dist, float viewDepth, bool
vec3 cc = cp.rgb * vec3(0.5, 0.57, 0.45) * mix(vec3(0.85, 0.92, 0.9), vec3(1.1, 1.05, 0.85), smoothstep(-0.35, 0.35, N.z)) * (0.75 + 0.35 * lush);
gA = mix(gA, cc, max(cp.a, 0.35) * carpetW * 0.97);
}
// The blades' own patches (grass_cull.comp's bladeField): patchiness and dry patches, so where
// the blades thin out the ground they stand on carries the same meadow, not a lawn
{
float patchy = fbmC(cheap, p.xz * 0.045, 3) * 0.5 + 0.5;
float dryp = smoothstep(0.2, 0.8, gnoise(p.xz * 0.33 + 17.0) * 0.5 + 0.5);
vec3 pf = mix(vec3(0.7, 0.8, 0.55), vec3(1.1, 1.05, 0.85), patchy) * mix(vec3(0.92, 1.0, 0.95), vec3(1.30, 1.10, 0.62), dryp);
// and the tussocks' own shade, half a metre across: where blades stand a pixel wide the ground
// is most of what shows, and it has to carry the same light and dark as the blades on it
float tus = 0.55 + 0.80 * (gnoise(p.xz * 1.9 + 41.0) * 0.5 + 0.5);
gA *= mix(vec3(1.0), pf / vec3(0.95, 0.96, 0.72) * tus, grassW);
if (u_grass_reach > 0.0) gA *= mix(1.0, mix(0.50, 1.0, smoothstep(u_grass_reach * 0.25, u_grass_reach, dist)), grassW);
}
// Subalpine forest floor: dark duff where the stands are dense. The photograph-driven
// term marks duff only where the survey actually shows dense conifer, and is the same
// at any distance — ground shading must not depend on where the viewer is.