scene.org File Archive

File download

<root>­/­parties­/­2013­/­sundown13­/­shadertoy/demo.txt

File size:
3 640 bytes (3.55K)
File date:
2013-09-11 23:06:04
Download count:
all-time: 84

Preview

vec3 COLOR1 = vec3(0.0, 1.0, 2.0);
vec3 COLOR2 = vec3(0.0, 0.0, 10.1);
float BLOCK_WIDTH = 0.005;
float time1 = 12.5;
float time2 = 20.0; //60.5;
float time3 = 30.0; //118.0;
float time4 = 40.0; //140.0;
float time5 = 50.0; //150.0;
float time6 = 58.0;
float time7 = 65.0;
float time8 = 80.0;
float time9 = 82.0;

void main(void)
{
	vec2 uv = gl_FragCoord.xy / iResolution.xy;
	
	// To create the BG pattern
	vec3 final_color = vec3(1.0);
	vec3 bg_color = vec3(0.0);
	vec3 bar_color = vec3(0.0);
	
	float c1 = mod(uv.x, 3.0 * BLOCK_WIDTH);
	c1 = step(BLOCK_WIDTH, c1);
	
	float c2 = mod(uv.y, 2.0 * BLOCK_WIDTH);
	c2 = step(BLOCK_WIDTH, c2);
	
	bg_color = mix(uv.x * COLOR1, uv.y * COLOR2, c1 * c2);
	
	for(float i = 0.0; i < 15.0; i++) {
		
		if (uv.x > 50.0) {
			uv.y += (0.09 * asin(uv.x + i/7.0 + iGlobalTime ));		
		} else if (iGlobalTime < time1){
			uv.y += (0.5 * tan(uv.x + i/50.0 + iGlobalTime ));
		} else if (iGlobalTime > time1 && (iGlobalTime < time2 || iGlobalTime > time9)) {
			uv.y += (0.07 * tan(uv.y + uv.x + i/500.0 + iGlobalTime ));
		} else if (iGlobalTime > time3 && iGlobalTime < time9) {
			uv.y += (1.0 * sqrt(uv.y + uv.x + i/5000.0 + iGlobalTime ));
			uv.y += (0.1 * cos(uv.y + uv.x + i/5000.0 + iGlobalTime ));
		} else if (iGlobalTime > time7 && iGlobalTime < time9) {
			uv.y += (1.0 * sqrt(uv.y + uv.x + i/5000.0 + iGlobalTime ));
			uv.y += (0.1 * tan(uv.y + uv.x + i/5000.0 + iGlobalTime ));
		} else {
			uv.y += (0.05 * tan(uv.x + i/500.0 + iGlobalTime ));
		}
		
		// Change the color
		if (uv.y > 60.0 && iGlobalTime < time1) {
			bar_color = vec3(0.0, 0.0, atan(uv.x * iGlobalTime / 3.0));
		} else if (uv.y > 59.0 && iGlobalTime < time3) {
			bar_color += vec3(0.0, 0.0, uv.y / 2.0);
		} else if (uv.y > 60.0 && iGlobalTime > time3) {
			bar_color += vec3(0.0, 0.0, uv.y / 500.0);
		}
	}
		
	final_color = bg_color + bar_color;
	
	vec4 texture = vec4(1.0);
	
	// Change the texture
	if (iGlobalTime < time1) { 
		texture = texture2D(iChannel0, uv);
	} else if (iGlobalTime >= time1 && iGlobalTime < time2) {
		texture = texture2D(iChannel1, uv);
	} else if (iGlobalTime > time2 && iGlobalTime < time3) {
		texture = texture2D(iChannel2, uv);
	} else if (iGlobalTime >= time3 && iGlobalTime < time4) {
		texture = texture2D(iChannel3, uv);		
		vec2 texture2 = texture2D(iChannel3, uv + sin(iGlobalTime) * 0.1).rg - 0.5;
		texture = texture2D(iChannel3, uv + texture2 * 0.1);
	} else if (iGlobalTime >= time4 && iGlobalTime < time5) {
		texture = texture2D(iChannel3, uv);		
		vec2 texture2 = texture2D(iChannel3, uv + sin(iGlobalTime) * 0.5).rg - 0.5;
		texture = texture2D(iChannel3, uv + texture2 * 0.1);
	} else if (iGlobalTime >= time5 && iGlobalTime < time6) {
		texture = texture2D(iChannel3, uv);				
	} else if (iGlobalTime >= time6 && iGlobalTime < time7) {
		texture = texture2D(iChannel3, uv);		
		vec2 texture2 = texture2D(iChannel3, uv * sin(iGlobalTime) * 0.1).rg - 0.5;
		texture = texture2D(iChannel3, uv + texture2 * 0.1);
	} else if (iGlobalTime >= time7 && iGlobalTime < time8) {
		texture = texture2D(iChannel1, uv);
		vec2 texture2 = texture2D(iChannel1, uv + sin(iGlobalTime) * 0.01).rg - 0.5;
		texture = texture2D(iChannel1, uv + texture2 * 0.1);
		
		vec2 texture3 = texture2D(iChannel0, uv + cos(iGlobalTime) * 0.01).rg - 0.01;
		texture = texture2D(iChannel3,uv + texture2 + texture3 * 0.01);
	} else if (iGlobalTime >= time8) {
		texture = texture2D(iChannel3, uv);		
		vec2 texture2 = texture2D(iChannel3, uv * sin(iGlobalTime) * 0.1).rg - 0.5;
		texture = texture2D(iChannel3, uv + texture2 * 0.1);
	}
	
	gl_FragColor = vec4(final_color * texture.y * texture.x, 1.0);
}