scene.org File Archive

File download

<root>­/­parties­/­2014­/­tokyodemofest14­/­7_lines_glsl_graphics_compo/fakeaobench-ao-kun.txt

File size:
582 bytes (582B)
File date:
2014-04-06 23:04:12
Download count:
all-time: 625

Screenshot (by pouët.net)

Screenshot

Preview

#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 resolution;float h(vec3 p, vec4 r){return length(r.xyz-p)-r.w;}
float s(vec3 p){return min(min(min((4.+p.y),h(p,vec4(0,-2,20,2))),h(p,vec4(-7,
-2,25,2))),h(p,vec4(7,-2,15,2)));}vec4 x(vec3 dir){vec3 p=vec3(0),e=vec3(.001,
0,0);dir.y*=.5;for(int i=0;i<84;i++)p+=s(p)*dir;vec3 n=normalize(vec3(s(p)-s(p
-e.xyy),s(p+e.yxy)-s(p),s(p)-s(p-e.yyx)));float a,d=2.5,o;for(int i=0;i<8;i++)
{o+=(float(i)-s(p+n*float(i)))/d;d*=2.;}a=.9-o;a*=a;return vec4(a,a,a,1);}void
main(){gl_FragColor=x(vec3(gl_FragCoord.xy/resolution*2.-1.,1));}