Skip to content

Instantly share code, notes, and snippets.

@lcrs
Created November 24, 2014 19:18
Show Gist options
  • Save lcrs/21065f07e096f1c1f935 to your computer and use it in GitHub Desktop.
Save lcrs/21065f07e096f1c1f935 to your computer and use it in GitHub Desktop.
glasso
uniform float adsk_time;
uniform float adsk_result_w, adsk_result_h;
uniform sampler2D front, matte;
float get(vec2 p) {
return texture2D(matte, p).r;
}
void main(void)
{
vec2 resolution = vec2(adsk_result_w, adsk_result_h);
vec2 p = gl_FragCoord.xy / resolution;
float g = get(p);
vec3 n = normalize(vec3(g - get(p+vec2(0.01, 0.0)), g - get(p+vec2(0.0, 0.01)), 0.3));
p += n.xy * -0.2;
vec3 c = texture2D(front, p).rgb;
c *= n.z * 0.84;
c += 0.2 * pow(abs(dot(n, vec3(0.7))), 80.0);
gl_FragColor = vec4(c, 1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment