Skip to content

Instantly share code, notes, and snippets.

@marcosbitetti
Created March 12, 2015 20:13
Show Gist options
  • Save marcosbitetti/b8847180312a1b8596c7 to your computer and use it in GitHub Desktop.
Save marcosbitetti/b8847180312a1b8596c7 to your computer and use it in GitHub Desktop.
// GLSL
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord.xy / iResolution.xy;
vec2 med = vec2(0.5,0.5);//(uv*0.5) - 1.0;
vec2 disVec = med-uv;
float l = disVec.x*disVec.x + disVec.y*disVec.y; //length(disVec);
float ll = 1.0 - l*l*4.0;
vec2 dist = med - disVec*ll;
fragColor = texture2D(iChannel0, dist);
}
// Godot shader
uniform float factor = 2.0;
vec2 dir = vec2(0.5,0.5) - UV;
float l = dir.x*dir.x + dir.y*dir.y;
float r = 1.0 - l*l*factor;
COLOR.rgb = texscreen(vec2(0.5,0.5)-dir*r);
// Other GLSL experiment
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord.xy / iResolution.xy;
float f = mod(iGlobalTime,1.0);
vec4 cor = texture2D(iChannel0, uv);
vec4 red = vec4(f*f, 0.0, 0.0, 1.0);
fragColor = cor+red;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment