Approximate sea HScroll
This commit is contained in:
parent
17523985bd
commit
544ca5be0b
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue