From 169aeadf496fe3edd0e6a20fe719de3a136f2827 Mon Sep 17 00:00:00 2001 From: lcddisplay Date: Wed, 11 Nov 2026 20:54:48 +0100 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD --- shaders/ogl46/mat_snow_windscreen.frag | 8 +++++--- shaders/ogl46/water_snow.comp | 3 ++- shaders/vk14/mat_snow_windscreen.frag | 8 +++++--- shaders/vk14/water_snow.comp | 3 ++- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/shaders/ogl46/mat_snow_windscreen.frag b/shaders/ogl46/mat_snow_windscreen.frag index bce56173d..d9624fa3d 100644 --- a/shaders/ogl46/mat_snow_windscreen.frag +++ b/shaders/ogl46/mat_snow_windscreen.frag @@ -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); } diff --git a/shaders/ogl46/water_snow.comp b/shaders/ogl46/water_snow.comp index 251800ed1..313d67866 100644 --- a/shaders/ogl46/water_snow.comp +++ b/shaders/ogl46/water_snow.comp @@ -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); diff --git a/shaders/vk14/mat_snow_windscreen.frag b/shaders/vk14/mat_snow_windscreen.frag index 648eed85f..3c72e913f 100644 --- a/shaders/vk14/mat_snow_windscreen.frag +++ b/shaders/vk14/mat_snow_windscreen.frag @@ -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); } diff --git a/shaders/vk14/water_snow.comp b/shaders/vk14/water_snow.comp index fcafd5bc5..52345a264 100644 --- a/shaders/vk14/water_snow.comp +++ b/shaders/vk14/water_snow.comp @@ -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);