18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 14:16:48 +01:00

Snow windscreen: wet thick snow closes the glass, flakes stick to snow

- The cover of wet snow (wetness above 0.35, near zero, where the flakes
  land half melted) was drawn with the slush tile, translucent by itself
  (alpha ~0.4), so a glass covered in any amount of it never closed. The
  cover is packed snow once it gets thick (from 0.75 mm, opaque at 2.5 mm),
  greyer when wet by its tone; slush only while it's thin.
- The dry flakes bounced off a moving glass also where snow lay already,
  so the wiped glass (bare, wet from the blade) caught more of them than
  the snow around it. They bounce off a bare glass only now (below
  0.05-0.3 mm of snow); on snow they stick.
No assets change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
This commit is contained in:
lcddisplay
2026-11-11 20:54:48 +01:00
committed by Claude
parent f564c689c6
commit 4248fd9796
4 changed files with 14 additions and 8 deletions
+5 -3
View File
@@ -280,9 +280,13 @@ void snLayer(vec2 span, float pixelUV, vec2 shift, uint salt, bool covers, inout
vec2 local;
if (false == snLocal(p, centre, size, vec2(1.0), rot, flip, aniso, local))
continue;
// thin wet icy snow lets some light (and the bent picture) through, a thick layer none
float deep = smoothstep(snow_cover * 3.0, snow_deep, q.x);
int tile;
// the cover: slush while it's thin and wet; thick snow is packed snow however wet it is (the slush tile is translucent
// by itself, a glass covered with it never closes; the wet one is greyer by its tone)
if (cover > 0.5)
tile = (wet > 0.35) ? 14 : 12 + int(kind * 2.0); // slush, packed snow
tile = ((wet > 0.35) && (deep < 0.5)) ? 14 : 12 + int(kind * 2.0);
else if (wet > 0.2)
tile = 8 + int(kind * 2.0); // wet lumps
else if (size < 0.8)
@@ -290,8 +294,6 @@ void snLayer(vec2 span, float pixelUV, vec2 shift, uint salt, bool covers, inout
else
tile = 10 + int(kind * 2.0); // clumps
float thick = 1.0 - exp(-q.x / (snow_opaque * mix(1.0, 0.5, q.z)));
// thin wet icy snow lets some light (and the bent picture) through, a thick layer none
float deep = smoothstep(snow_cover * 3.0, snow_deep, q.x);
float alpha = mix(mix(0.7, 0.9, thick), 1.0, deep);
snSprite(local, min(tile, 14), alpha, snTone(q, random), rot, flip, snLod(pixelUV, size / max(perUV.x, perUV.y)), 1.0 - deep, acc);
}
+2 -1
View File
@@ -253,7 +253,8 @@ void main()
float wet = state.y / (state.y + state.x * density + 1e-4);
// the dry flakes bounce off a moving glass (powder is blown away), the wet ones (near zero) and those landing on wet snow or
// water stay
float dry = (1.0 - smoothstep(0.1, 0.4, wet)) * (1.0 - smoothstep(-3.0, 0.0, water_up.w));
// (only on a bare glass: a flake sticks to the snow already there)
float dry = (1.0 - smoothstep(0.1, 0.4, wet)) * (1.0 - smoothstep(-3.0, 0.0, water_up.w)) * (1.0 - smoothstep(0.05, 0.3, state.x));
float sticking = 1.0 - 0.4 * smoothstep(5.0, 25.0, speed) * dry;
float landings = water_snow.x * SNOW_FALL_SHARE / max(water_air.w, 0.1) * facing * area * seconds * sticking;
vec4 random = water_random(place, snow_slot, water_counts.x, 0x5e0du);
+5 -3
View File
@@ -285,9 +285,13 @@ void snLayer(vec2 span, float pixelUV, vec2 shift, uint salt, bool covers, inout
vec2 local;
if (false == snLocal(p, centre, size, vec2(1.0), rot, flip, aniso, local))
continue;
// thin wet icy snow lets some light (and the bent picture) through, a thick layer none
float deep = smoothstep(snow_cover * 3.0, snow_deep, q.x);
int tile;
// the cover: slush while it's thin and wet; thick snow is packed snow however wet it is (the slush tile is translucent
// by itself, a glass covered with it never closes; the wet one is greyer by its tone)
if (cover > 0.5)
tile = (wet > 0.35) ? 14 : 12 + int(kind * 2.0); // slush, packed snow
tile = ((wet > 0.35) && (deep < 0.5)) ? 14 : 12 + int(kind * 2.0);
else if (wet > 0.2)
tile = 8 + int(kind * 2.0); // wet lumps
else if (size < 0.8)
@@ -295,8 +299,6 @@ void snLayer(vec2 span, float pixelUV, vec2 shift, uint salt, bool covers, inout
else
tile = 10 + int(kind * 2.0); // clumps
float thick = 1.0 - exp(-q.x / (snow_opaque * mix(1.0, 0.5, q.z)));
// thin wet icy snow lets some light (and the bent picture) through, a thick layer none
float deep = smoothstep(snow_cover * 3.0, snow_deep, q.x);
float alpha = mix(mix(0.7, 0.9, thick), 1.0, deep);
snSprite(local, min(tile, 14), alpha, snTone(q, random), rot, flip, snLod(pixelUV, size / max(perUV.x, perUV.y)), 1.0 - deep, acc);
}
+2 -1
View File
@@ -256,7 +256,8 @@ void main()
float wet = state.y / (state.y + state.x * density + 1e-4);
// the dry flakes bounce off a moving glass (powder is blown away), the wet ones (near zero) and those landing on wet snow or
// water stay
float dry = (1.0 - smoothstep(0.1, 0.4, wet)) * (1.0 - smoothstep(-3.0, 0.0, water_up.w));
// (only on a bare glass: a flake sticks to the snow already there)
float dry = (1.0 - smoothstep(0.1, 0.4, wet)) * (1.0 - smoothstep(-3.0, 0.0, water_up.w)) * (1.0 - smoothstep(0.05, 0.3, state.x));
float sticking = 1.0 - 0.4 * smoothstep(5.0, 25.0, speed) * dry;
float landings = water_snow.x * SNOW_FALL_SHARE / max(water_air.w, 0.1) * facing * area * seconds * sticking;
vec4 random = water_random(place, snow_slot, water_counts.x, 0x5e0du);