Created
September 2, 2014 09:48
-
-
Save 0b5vr/8323465bd0fdc2a5ad7c to your computer and use it in GitHub Desktop.
v_gate
This file contains 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
uniform ivec2 size; | |
uniform float m; | |
uniform sampler2D texture; | |
uniform sampler2D tex; | |
void main() | |
{ | |
ivec2 p=ivec2(gl_FragCoord.xy); | |
gl_FragColor=texelFetch(texture,p,0)+texelFetch(tex,p,0)*m; | |
} |
This file contains 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
float eS=90; | |
void setup() | |
{ | |
size(240,240,P3D); | |
} | |
void draw() | |
{ | |
background(0); | |
PGraphics blurG=createGraphics(width,height,P3D); | |
PShader add=loadShader("add.glsl"); | |
for(int blur=0;blur<11;blur++) | |
{ | |
float t=(frameCount*2)%400+blur*.2; | |
blurG.beginDraw(); | |
blurG.background(0); | |
blurG.stroke(0,55); | |
blurG.lightFalloff(0,0.001,0.); | |
blurG.directionalLight(255,255,255,0,0,1); | |
blurG.beginCamera(); | |
blurG.camera(-50,50,-200,sin(PI*t*.01)*10,sin(PI*t*.005+1.2)*10,0,sin(4.42-PI*t*.005)*.3,1,0); | |
blurG.endCamera(); | |
blurG.fill(0,102,255); | |
blurG.pushMatrix(); | |
blurG.rotateX(t*PI*.01); | |
blurG.rotateY(t*PI*.01); | |
for(int c=0;c<8;c++) | |
{ | |
blurG.pushMatrix(); | |
blurG.rotateX(c%4*PI/2); | |
blurG.rotateY(c/4*PI); | |
blurG.beginShape(); | |
blurG.vertex(eS,0,0); | |
blurG.vertex(0,eS,0); | |
blurG.vertex(0,0,eS); | |
blurG.endShape(); | |
blurG.popMatrix(); | |
} | |
blurG.popMatrix(); | |
blurG.noLights(); | |
blurG.directionalLight(127,127,127,0,0,1); | |
blurG.lightFalloff(0,0.01,0.); | |
blurG.pointLight(0,102,255,0,0,0); | |
blurG.fill(255,0,0); | |
for(int c2=0;c2<3;c2++) | |
{ | |
for(int c=0;c<16;c++) | |
{ | |
blurG.pushMatrix(); | |
blurG.rotateY(-t*PI*.01+c*.1); | |
blurG.rotateX(-t*PI*.01+c*.1); | |
blurG.rotateZ(c2*PI/3*2); | |
blurG.translate(0,120,0); | |
blurG.rotate(t*PI*.005); | |
blurG.box(3-c*.1); | |
blurG.popMatrix(); | |
} | |
} | |
blurG.fill(102,0,255); | |
for(int cr=0;cr<8;cr++) | |
{ | |
float pha=(t*.5+cr*50+cr/4*4)%200; | |
blurG.pushMatrix(); | |
blurG.translate(0,0,1000-pha*10); | |
blurG.rotateZ(pha*.01); | |
blurG.beginShape(); | |
for(float c=0;c<=PI*2;c+=PI/32) | |
{ | |
blurG.vertex(cos(c)*200*pow(pha*0.005,.3),sin(c)*200*pow(pha*0.005,.3)); | |
} | |
blurG.beginContour(); | |
for(float c=0;c<=PI*2;c+=PI/32) | |
{ | |
if(c%(PI/2)<1){blurG.vertex(cos(c)*170*pow(pha*0.005,.3),sin(c)*170*pow(pha*0.005,.3));} | |
else{blurG.vertex(cos(c)*150*pow(pha*0.005,.3),sin(c)*150*pow(pha*0.005,.3));} | |
} | |
blurG.endContour(); | |
blurG.endShape(); | |
blurG.popMatrix(); | |
} | |
blurG.fill(127,127,127); | |
blurG.pushMatrix(); | |
blurG.translate(0,0,1400); | |
for(int c2=0;c2<40;c2++) | |
{ | |
for(float c=0;c<PI*2;c+=PI/8) | |
{ | |
float pha=(floor(t*.2)*.2)%8; | |
blurG.beginShape(); | |
blurG.vertex(cos(c)*(300+200*noise(c,c2,pha)),sin(c)*(300+200*noise(c,c2,pha)),-(50*c2+t*5)%2000); | |
blurG.vertex(cos((c+PI/8)%(PI*2))*(300+200*noise((c+PI/8)%(PI*2),c2,pha)),sin((c+PI/8)%(PI*2))*(300+200*noise((c+PI/8)%(PI*2),c2,pha)),-(50*c2+t*5)%2000); | |
blurG.vertex(cos(c)*(300+200*noise(c,(1+c2),pha)),sin(c)*(300+200*noise(c,(1+c2),pha)),-(50*(1+c2)+t*5)%2000); | |
blurG.endShape(CLOSE); | |
blurG.beginShape(); | |
blurG.vertex(cos(c)*(300+200*noise(c,(1+c2),pha)),sin(c)*(300+200*noise(c,(1+c2),pha)),-(50*(1+c2)+t*5)%2000); | |
blurG.vertex(cos((c+PI/8)%(PI*2))*(300+200*noise((c+PI/8)%(PI*2),(1+c2),pha)),sin((c+PI/8)%(PI*2))*(300+200*noise((c+PI/8)%(PI*2),(1+c2),pha)),-(50*(1+c2)+t*5)%2000); | |
blurG.vertex(cos((c+PI/8)%(PI*2))*(300+200*noise((c+PI/8)%(PI*2),c2,pha)),sin((c+PI/8)%(PI*2))*(300+200*noise((c+PI/8)%(PI*2),c2,pha)),-(50*c2+t*5)%2000); | |
blurG.endShape(CLOSE); | |
} | |
} | |
blurG.popMatrix(); | |
blurG.endDraw(); | |
add.set("size",width,height); | |
add.set("tex",blurG); | |
add.set("m",sin(blur*PI/11)*.2); | |
filter(add); | |
} | |
// saveFrame("capture/####.png"); | |
// if(frameCount==210)exit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment