Skip to content

Instantly share code, notes, and snippets.

@r-lyeh-archived
Last active July 5, 2021 01:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r-lyeh-archived/170b53fcdc0e17afcf15 to your computer and use it in GitHub Desktop.
Save r-lyeh-archived/170b53fcdc0e17afcf15 to your computer and use it in GitHub Desktop.
postprocessing effects
// Created by inigo quilez - iq/2013
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// https://www.shadertoy.com/view/4dfGzn
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 q = fragCoord.xy / iResolution.xy;
vec2 uv = vec2(q.x,q.y);
// zooming
// uv = 0.5 + (q-0.5)*(0.9 + 0.1*sin(0.2*iGlobalTime));
vec3 oricol = texture2D( iChannel0, vec2(q.x,1.0-q.y) ).xyz;
vec3 col = texture2D(iChannel0,vec2(uv.x,-uv.y)).rgb;
// color separation
// col.r = texture2D(iChannel0,vec2(uv.x+0.003,-uv.y)).x;
// col.g = texture2D(iChannel0,vec2(uv.x+0.000,-uv.y)).y;
// col.b = texture2D(iChannel0,vec2(uv.x-0.003,-uv.y)).z;
// contrast
// col = clamp(col*0.5+0.5*col*col*1.2,0.0,1.0);
// vignette
// col *= 0.5 + 0.5*16.0*uv.x*uv.y*(1.0-uv.x)*(1.0-uv.y);
// tint
// col *= vec3(0.95,1.05,0.95);
// scanlines
// col *= 0.9+0.1*sin(10.0*iGlobalTime+uv.y*1000.0);
// brightness flickering
// col *= 0.99+0.01*sin(110.0*iGlobalTime);
// curtain effect
// float comp = smoothstep( 0.2, 0.7, sin(iGlobalTime) );
// col = mix( col, oricol, clamp(-2.0+2.0*q.x+3.0*comp,0.0,1.0) );
fragColor = vec4(col,1.0);
}
// see also: http://clemz.io/article-retro-shaders-rayman-legends
// see also: http://www.gamasutra.com/blogs/KylePittman/20150420/241442/CRT_Simulation_in_Super_Win_the_Game.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment