From 544ca5be0b87beeac5b44d96d887966fe287df37 Mon Sep 17 00:00:00 2001 From: Luke Hubmayer-Werner Date: Fri, 28 Jul 2023 17:01:24 +0930 Subject: [PATCH] Approximate sea HScroll --- shaders/worldmap_shader.gdshader | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/shaders/worldmap_shader.gdshader b/shaders/worldmap_shader.gdshader index abfadae..1632d14 100644 --- a/shaders/worldmap_shader.gdshader +++ b/shaders/worldmap_shader.gdshader @@ -27,9 +27,16 @@ vec2 get_tile_atlas_uv(float tile_id, vec2 uv) { if (all(greaterThanEqual(out_uv, sea_tile_uv)) && all(lessThan(out_uv, sea_tile_uv_end))) { vec2 sea_tile_uv_diff = out_uv - sea_tile_uv; vec2 pos = sea_tile_uv_diff * sea_tile_size_inv; + // Silly warpy effects // pos.x = fract(pos.x + fract(TIME*0.4) + cos(pos.y*0.5) + 20.0*sin(uv.y*20.0)); - pos.x = fract(pos.x + fract(TIME*0.4) + 20.0*sin(uv.y*20.0)); - pos.y = fract(pos.y + 0.5*sin(sin(TIME*0.5 + 32.0*uv.x))); + // pos.x = fract(pos.x + fract(TIME*0.4) + 20.0*sin(uv.y*20.0)); + // pos.y = fract(pos.y + 0.5*sin(sin(TIME*0.5 + 32.0*uv.x))); + + // Real animation seems to scroll in a cycle of shift row 1px, next frame, increment by 9 rows, shift that one, repeat + // i.e. every 16 frames it will have scrolled all rows 1px + // every 256 frames it will have performed a full scroll + // At 60fps this is one full scroll every 4.266... seconds + pos.x = fract(pos.x - TIME/4.267 + (pos.y * (9.0/16.0))); out_uv = mix(sea_tile_uv, sea_tile_uv_end, pos); } // TODO: waterfall VScroll UV modulation