Files
2024-01-17 11:12:57 +03:00

32 lines
984 B
Plaintext

const highp float shake_power = 0.04;
const highp float shake_block_size = 30.5;
const highp float fade = 0.01;
const highp vec2 direction_r = vec2( 1.0, 0.0 );
const highp vec2 direction_g = vec2( 0.4, 1.0 );
const highp vec2 direction_b = vec2( -0.7, -0.3 );
uniform sampler2D SCREEN_TEXTURE;
highp float random (highp float seed)
{
return fract ( 543.2543 * sin( dot( vec2( seed, seed ), vec2( 3525.46, -54.3415 ) ) ) );
}
void fragment()
{
highp vec2 fixed_uv = UV;
fixed_uv.x += (
random(
( trunc( UV.y * shake_block_size ) / shake_block_size )
+ TIME
) - 0.5
) * shake_power * ( fade * 12.0 );
COLOR = vec4(
textureLod( SCREEN_TEXTURE, fixed_uv + normalize( direction_r ) * fade, 0.0 ).r
, textureLod( SCREEN_TEXTURE, fixed_uv + normalize( direction_g ) * fade, 0.0 ).g
, textureLod( SCREEN_TEXTURE, fixed_uv + normalize( direction_b ) * fade, 0.0 ).b
, 0.0
) * ( 1.0 - fade );
COLOR.a = 1.0;
}