godot-visual-effects/camera-effects/camera-shake.gdshader
Marinho Brandao 41f7a04b4a Camera Shake
2023-12-14 17:25:36 +01:00

14 lines
352 B
Plaintext

shader_type canvas_item;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear;
uniform float strength = 20.0;
uniform float speed = 1.0;
void fragment() {
float deviation = strength * sin(TIME * speed);
vec2 offset = vec2(deviation, 0.0) * SCREEN_PIXEL_SIZE;
vec4 color = texture(SCREEN_TEXTURE, UV + offset);
COLOR = color;
}