Files
OldThink/Resources/Textures/Shaders/drunk.swsl

23 lines
940 B
Plaintext
Raw Normal View History

uniform sampler2D SCREEN_TEXTURE;
uniform highp float boozePower;
const highp float TimeScale = 0.5;
const highp float DistortionScale = 0.01;
void fragment() {
highp float mod = mix(0.0, DistortionScale, boozePower);
vec2 coord = FRAGCOORD.xy * SCREEN_PIXEL_SIZE.xy;
float time = TIME * TimeScale;
vec2 offset = vec2((mod * 1.5) * sin(time * 1.5), (mod * 2.0) * cos(time * 1.5 - 0.2));
highp vec4 tex1 = zTextureSpec(SCREEN_TEXTURE, coord + offset);
if (boozePower > 0.5) {
offset = vec2((mod * 2 - DistortionScale) * sin(time * 0.333 - 0.2), (mod * 2 - DistortionScale) * cos(time * 0.333));
tex1 = mix(tex1, zTextureSpec(SCREEN_TEXTURE, coord + offset), mix(0.0, 0.3, boozePower*2-1));
}
offset = vec2((mod * 1.0) * sin(time * 1.0 + 0.1), (mod * 1.0) * cos(time * 1.0));
COLOR = mix(tex1, zTextureSpec(SCREEN_TEXTURE, coord + offset), mix(0.0, 0.5, boozePower));
}