Created
December 11, 2020 14:32
-
-
Save marcouberti/912df18faecee732a0f09aeaed707cce to your computer and use it in GitHub Desktop.
KodeLife basic RGB glitch shader
This file contains hidden or 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
#version 150 | |
uniform float time; | |
uniform vec2 resolution; | |
uniform vec2 mouse; | |
uniform vec3 spectrum; | |
uniform sampler2D texture0; | |
out vec4 fragColor; | |
void main(void) | |
{ | |
vec2 uv = gl_FragCoord.xy / resolution; | |
// displacement | |
vec2 d = vec2(sin(spectrum.y)*0.5, 0); | |
// texture + displacement | |
vec3 r = texture(texture0, (uv + d)).rgb; | |
vec3 g = texture(texture0, uv + d*2.0).rgb; | |
vec3 b = texture(texture0, uv + d*3.0).rgb; | |
// rgb glitch | |
vec3 glitch = vec3(r.r, g.g, b.b); | |
fragColor = vec4(glitch, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment