weird: done with pollock, added splatter in the process

This commit is contained in:
2017-06-10 19:25:30 -04:00
parent 3c7201641e
commit bd293fbd6a
2 changed files with 107 additions and 0 deletions

53
weird/pollock.glsl Normal file
View File

@@ -0,0 +1,53 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
vec2 random2(vec2 st){
st = vec2( dot(st,vec2(127.1,311.7)),
dot(st,vec2(269.5,183.3)));
return -1.0 + 2.0*fract(sin(st)*43758.5453123);
}
float noise(vec2 st) {
vec2 i = floor(st);
vec2 f = fract(st);
vec2 u = f*f*(3.0-2.0*f);
return mix( mix( dot( random2(i + vec2(0.0,0.0) ), f - vec2(0.0,0.0) ),
dot( random2(i + vec2(1.0,0.0) ), f - vec2(1.0,0.0) ), u.x),
mix( dot( random2(i + vec2(0.0,1.0) ), f - vec2(0.0,1.0) ),
dot( random2(i + vec2(1.0,1.0) ), f - vec2(1.0,1.0) ), u.x), u.y);
}
float shape(vec2 st, float radius) {
st = vec2(0.5)-st;
float r = length(st)*2.0;
float a = atan(st.y,st.x);
float m = abs(mod(a,3.14*2.)-3.14)/3.6;
float f = radius;
f += sin(a*20.);
return 1.-smoothstep(f,f+0.01,r);
}
float splash(vec2 st) {
return shape(st, .3) - shape(st, .27);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution.xy;
st.x *= u_resolution.x/u_resolution.y;
vec3 color = vec3(0.0);
st += noise(st*2.);
for (int i = 0; i < 160; i++) {
color += splash(st*(random2(vec2(float(i)))*3.));
}
color += smoothstep(.3,.31,noise(st*10.));
gl_FragColor = vec4(1.-color,1.0);
}

54
weird/splatter_noise.glsl Normal file
View File

@@ -0,0 +1,54 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
vec2 random2(vec2 st){
st = vec2( dot(st,vec2(127.1,311.7)),
dot(st,vec2(269.5,183.3)) );
return -1.0 + 2.0*fract(sin(st)*43758.5453123);
}
// Value Noise by Inigo Quilez - iq/2013
// https://www.shadertoy.com/view/lsf3WH
float noise(vec2 st) {
vec2 i = floor(st);
vec2 f = fract(st);
vec2 u = f*f*(3.0-2.0*f);
return mix( mix( dot( random2(i + vec2(0.0,0.0) ), f - vec2(0.0,0.0) ),
dot( random2(i + vec2(1.0,0.0) ), f - vec2(1.0,0.0) ), u.x),
mix( dot( random2(i + vec2(0.0,1.0) ), f - vec2(0.0,1.0) ),
dot( random2(i + vec2(1.0,1.0) ), f - vec2(1.0,1.0) ), u.x), u.y);
}
float shape(vec2 st, float radius) {
st = vec2(0.5)-st;
float r = length(st)*2.0;
float a = atan(st.y,st.x);
float m = abs(mod(a,3.14*2.)-3.14)/3.6;
float f = radius;
f += (sin(a*20.)*.1*pow(m,2.));
return 1.-smoothstep(f,f+0.007,r);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution.xy;
st.x *= u_resolution.x/u_resolution.y;
vec3 color = vec3(0.0);
float t = 1.0;
st += noise(st*2.)*t;
for (int i = 0; i < 90; i++) {
st += abs(tan(u_time))+0.05;
color += shape(st, .3);
color -= shape(st, .27);
color += smoothstep(0.28, .3,noise(st*10.));
color -= smoothstep(.35,.4,noise(st*10.));
}
gl_FragColor = vec4(1.-color,1.0);
}