From f4ae5b826bed6aaec7d6911f36bdf20af7e30985 Mon Sep 17 00:00:00 2001 From: lcddisplay Date: Tue, 10 Nov 2026 21:42:57 +0100 Subject: [PATCH] Snow windscreen: the snow a blade pushes is counted once A texel ahead of a blade took the lines of every neighbour pointing at it, and the lines overlapped, so the snow pushed along grew at every step and the ends of the sweeps filled with ridges even on a glass with hardly any snow. A texel in the sweep takes only the line behind itself along the way of the blade, one off the sweep the line of one neighbour. No assets change. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD --- shaders/ogl46/water_snow.comp | 16 +++++++++++++++- shaders/vk14/water_snow.comp | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/shaders/ogl46/water_snow.comp b/shaders/ogl46/water_snow.comp index 356260b4d..f7f60b28a 100644 --- a/shaders/ogl46/water_snow.comp +++ b/shaders/ogl46/water_snow.comp @@ -11,7 +11,8 @@ // the water runs down as a film and is pushed by the air; and snow piled higher than its neighbours by more than it holds slips // onto them (a ridge left by a blade spreads into a wedge). what goes over the edge of the glass falls off // - the blades: a blade going over a texel in the step takes its snow (a little stays, and a wet trace of the water), and pushes -// it on in front of itself: the texel just ahead of the line of texels the blade went over gets their snow, packed. at the end +// it on in front of itself: the texel just ahead of the line of texels the blade went over gets their snow, packed (each texel +// to one texel at most: the snow pushed along is never counted twice). at the end // of its sweep the blade leaves it there, a ridge; pushed past the edge of the glass, it's gone // - the flakes land: as many as come to the glass facing the snow coming at it against the cab (and a few in the eddies of the // air where it doesn't face it), each bringing its snow to the texel; the faster the vehicle the more of the dry ones bounce off @@ -267,6 +268,16 @@ void main() crossed = true; continue; } + // every texel the blade went over goes to one texel ahead at most, so the snow it pushes isn't counted twice (it would + // grow at every step): in the sweep the texel takes the line of texels behind itself along the way of the blade, off the + // sweep (the blade pushes the snow out at its edge) the line of one of its neighbours pointing at it + if (snow_blade(texel, blade) > 0.001) + { + ivec2 way = snow_blade_way(texel, blade); + if ((way != ivec2(0)) && snow_crossed(texel - way, blade)) + pushed += snow_line(texel - way, blade, way); + continue; + } for (int k = 0; k < 8; ++k) { ivec2 from = texel + SNOW_AROUND[k]; @@ -274,7 +285,10 @@ void main() continue; ivec2 way = snow_blade_way(from, blade); if ((way != ivec2(0)) && (from + way == texel)) + { pushed += snow_line(from, blade, way); + break; + } } } if (crossed) diff --git a/shaders/vk14/water_snow.comp b/shaders/vk14/water_snow.comp index 769a3e1b6..e4ea47a86 100644 --- a/shaders/vk14/water_snow.comp +++ b/shaders/vk14/water_snow.comp @@ -11,7 +11,8 @@ // the water runs down as a film and is pushed by the air; and snow piled higher than its neighbours by more than it holds slips // onto them (a ridge left by a blade spreads into a wedge). what goes over the edge of the glass falls off // - the blades: a blade going over a texel in the step takes its snow (a little stays, and a wet trace of the water), and pushes -// it on in front of itself: the texel just ahead of the line of texels the blade went over gets their snow, packed. at the end +// it on in front of itself: the texel just ahead of the line of texels the blade went over gets their snow, packed (each texel +// to one texel at most: the snow pushed along is never counted twice). at the end // of its sweep the blade leaves it there, a ridge; pushed past the edge of the glass, it's gone // - the flakes land: as many as come to the glass facing the snow coming at it against the cab (and a few in the eddies of the // air where it doesn't face it), each bringing its snow to the texel; the faster the vehicle the more of the dry ones bounce off @@ -270,6 +271,16 @@ void main() crossed = true; continue; } + // every texel the blade went over goes to one texel ahead at most, so the snow it pushes isn't counted twice (it would + // grow at every step): in the sweep the texel takes the line of texels behind itself along the way of the blade, off the + // sweep (the blade pushes the snow out at its edge) the line of one of its neighbours pointing at it + if (snow_blade(texel, blade) > 0.001) + { + ivec2 way = snow_blade_way(texel, blade); + if ((way != ivec2(0)) && snow_crossed(texel - way, blade)) + pushed += snow_line(texel - way, blade, way); + continue; + } for (int k = 0; k < 8; ++k) { ivec2 from = texel + SNOW_AROUND[k]; @@ -277,7 +288,10 @@ void main() continue; ivec2 way = snow_blade_way(from, blade); if ((way != ivec2(0)) && (from + way == texel)) + { pushed += snow_line(from, blade, way); + break; + } } } if (crossed)