Created
May 4, 2020 13:57
-
-
Save jimmyjonezz/2fff550ba921fdc6a9120a65074fda2d to your computer and use it in GitHub Desktop.
animate anaglyph - https://pastebin.com/raw/f2cjp2LA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type canvas_item; | |
uniform float AMPLITUDE = .1; | |
uniform float SPEED = 5.0; | |
vec4 rgbShift( in vec2 p , in vec4 shift, in sampler2D tex) { | |
vec2 rs = vec2(shift.x,-shift.y); | |
vec2 gs = vec2(shift.y,-shift.z); | |
vec2 bs = vec2(shift.z,-shift.x); | |
float r = texture(tex, p+rs).x; | |
float g = texture(tex, p+gs).y; | |
float b = texture(tex, p+bs).z; | |
return vec4(r,g,b,1.0); | |
} | |
float rand(in vec2 n) { | |
return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453); | |
} | |
vec4 rgbnoise(in vec2 p) { | |
return vec4( vec3( rand(p+183.234), rand(p+32.28), rand(p+161.837) ) * rand(p), 1); | |
} | |
vec4 vec4pow( in vec4 v, in float p ) { | |
return vec4(pow(v.x,p),pow(v.y,p),pow(v.z,p),v.w); } | |
void fragment() { | |
vec4 c = vec4(0.0,0.0,0.0,1.0); | |
vec4 shift = vec4pow(rgbnoise(vec2(SPEED*TIME,2.0*SPEED*TIME/25.0 )),8.0)* vec4(AMPLITUDE,AMPLITUDE,AMPLITUDE,1.0); | |
c += rgbShift(SCREEN_UV, shift, SCREEN_TEXTURE); | |
c.a = texture(SCREEN_TEXTURE, SCREEN_UV).a; | |
COLOR = c; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment