This commit is contained in:
2024-06-01 14:44:18 +02:00
parent 52d3ca3c61
commit 0004cddea6
11 changed files with 447 additions and 31 deletions

View File

@@ -7,47 +7,23 @@ uniform float u_time;
#define PI 3.14159265359 #define PI 3.14159265359
const vec3 uAColor = vec3(.5); const vec3 uAColor = vec3(.5,.5,.5);
const vec3 uBColor = vec3(.5); const vec3 uBColor = vec3(.5,.5,.5);
const vec3 uCColor = vec3(1.); const vec3 uCColor = vec3(1.,1.,1.);
const vec3 uDColor = vec3(.3,.2,.2); const vec3 uDColor = vec3(.0,.33,.67);
//get colors from http://dev.thi.ng/gradients/ //get colors from http://dev.thi.ng/gradients/
vec3 cosPalette(float t) { vec3 cosPalette(float t) {
return uAColor + uBColor*cos(6.28318*(uCColor*t+uDColor)); return uAColor + uBColor*cos(6.28318*(uCColor*t+uDColor));
} }
float circleSDF(vec2 st) {
return length(st-.5)*2.;
}
float fill(float x, float size) {
return 1.-step(size, x);
}
void main() { void main() {
vec2 st = gl_FragCoord.xy/u_resolution; vec2 st = gl_FragCoord.xy/u_resolution;
float col = 0.0; vec3 color = vec3(0.0,0.0,0.0);
vec2 l = vec2(.5,.5)-(u_mouse/u_resolution);
l = l*.1;
float alpha = 1.0; float alpha = 1.0;
float dots = 17.;
float dotsize = .7;
vec2 off = vec2(.1,.1);
float movemod = sin(u_time)/2.+1.;
for (int i = 0; i < 4; i++) {
vec2 off1 = off * vec2(-1,1);
vec2 off2 = off * vec2(1,-1);
vec2 off3 = off * vec2(1,1);
vec2 off4 = off * vec2(-1,-1);
col += fill(circleSDF(fract(st*dots)+off1+l+movemod),dotsize)/4.;
col += fill(circleSDF(fract(st*dots)+off2+l),dotsize)/4.;
col += fill(circleSDF(fract(st*dots)+off3+l),dotsize)/4.;
col += fill(circleSDF(fract(st*dots)+off4+l),dotsize)/4.;
//col += fill(circleSDF(fract(st*dots + l*.9+off)*.3), dotsize);
off += vec2(.1,.1);
}
vec3 color = cosPalette(col);
gl_FragColor = vec4(color, alpha); gl_FragColor = vec4(color, alpha);
} }

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;
#define PI 3.14159265359
const vec3 uAColor = vec3(.5);
const vec3 uBColor = vec3(.5);
const vec3 uCColor = vec3(1.);
const vec3 uDColor = vec3(.3,.2,.2);
//get colors from http://dev.thi.ng/gradients/
vec3 cosPalette(float t) {
return uAColor + uBColor*cos(6.28318*(uCColor*t+uDColor));
}
float circleSDF(vec2 st) {
return length(st-.5)*2.;
}
float fill(float x, float size) {
return 1.-step(size, x);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
float col = 0.0;
vec2 l = vec2(.5,.5)-(u_mouse/u_resolution);
l = l*.1;
float alpha = 1.0;
float dots = 1.;
float dotsize = .7;
vec2 off = vec2(.1,.1);
float movemod = sin(u_time)/2.+1.;
col += fill(circleSDF(fract(st*dots)+l+movemod),dotsize)/4.;
for (int i = 0; i < 4; i++) {
vec2 off1 = off * vec2(-1,1);
vec2 off2 = off * vec2(1,-1);
vec2 off3 = off * vec2(1,1);
vec2 off4 = off * vec2(-1,-1);
col += fill(circleSDF(fract(st*dots)+off1+l+movemod),dotsize)/4.;
col += fill(circleSDF(fract(st*dots)+off2+l),dotsize)/4.;
col += fill(circleSDF(fract(st*dots)+off3+l),dotsize)/4.;
col += fill(circleSDF(fract(st*dots)+off4+l),dotsize)/4.;
//col += fill(circleSDF(fract(st*dots + l*.9+off)*.3), dotsize);
off += vec2(.1,.1);
}
vec3 color = cosPalette(col);
gl_FragColor = vec4(color, alpha);
}

View File

@@ -31,6 +31,11 @@ float fill(float x, float size) {
return 1.-step(size, x); return 1.-step(size, x);
} }
float stroke(in float x_coor, float s, float width){
float d = step(s,x_coor+width*.5)-step(s,x_coor-width*.5);
return clamp(d, 0.,1.);
}
void main() { void main() {
vec2 st = gl_FragCoord.xy/u_resolution; vec2 st = gl_FragCoord.xy/u_resolution;
vec3 color = vec3(0.0,0.0,0.0); vec3 color = vec3(0.0,0.0,0.0);
@@ -41,6 +46,10 @@ void main() {
//i don't understand what happens here //i don't understand what happens here
//it has to be fract causing this to look like that //it has to be fract causing this to look like that
color *= step(.5,fract(cross*4.)); color *= step(.5,fract(cross*4.));
color *= step(1.,cross);
color += fill(cross,.5);
color += stroke(rect,.65,.05);
color += stroke(rect,.75,.025);
gl_FragColor = vec4(color, alpha); gl_FragColor = vec4(color, alpha);
} }

View File

@@ -0,0 +1,47 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
#define PI 3.14159265359
const vec3 uAColor = vec3(.5,.5,.5);
const vec3 uBColor = vec3(.5,.5,.5);
const vec3 uCColor = vec3(1.,1.,1.);
const vec3 uDColor = vec3(.0,.33,.67);
//get colors from http://dev.thi.ng/gradients/
vec3 cosPalette(float t) {
return uAColor + uBColor*cos(6.28318*(uCColor*t+uDColor));
}
float circleSDF(vec2 st) {
return length(st-.5)*2.;
}
float vesicaSDF(vec2 st, float w) {
vec2 offset = vec2(w*.5,.0);
return max(circleSDF(st-offset), circleSDF(st+offset));
}
float fill(float x, float size) {
return 1.-step(size, x);
}
float flip(float v, float pct) {
return mix(v, 1.-v, pct);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
vec3 color = vec3(0.0,0.0,0.0);
float alpha = 1.0;
float ves = fill(vesicaSDF(st, .5),.8);
float lower = step((st.x+st.y)/2.,.5);
color += flip(ves, lower);
gl_FragColor = vec4(color, alpha);
}

View File

@@ -0,0 +1,46 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
#define PI 3.14159265359
const vec3 uAColor = vec3(.5,.5,.5);
const vec3 uBColor = vec3(.5,.5,.5);
const vec3 uCColor = vec3(1.,1.,1.);
const vec3 uDColor = vec3(.0,.33,.67);
//get colors from http://dev.thi.ng/gradients/
vec3 cosPalette(float t) {
return uAColor + uBColor*cos(6.28318*(uCColor*t+uDColor));
}
vec2 rotate(vec2 st, float a) {
st = mat2(cos(a),-sin(a),sin(a),cos(a))*(st-.5);
return st+.5;
}
float triSDF(vec2 st) {
st = (st*2.-1.)*2.;
return max(abs(st.x)*.866025+st.y*.5,-st.y*.5);
}
float fill(float x, float size) {
return 1.-step(size, x);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
vec3 color = vec3(0.0,0.0,0.0);
float alpha = 1.0;
st = rotate(st, radians(-25.));
float sdf = triSDF(st);
//why does dividing the triangle with a larger triangle create a smaller black triangle area at the bottom?
sdf /= triSDF(st+vec2(.0,.2));
color += sdf; //fill(abs(sdf),.56);
gl_FragColor = vec4(color, alpha);
}

View File

@@ -0,0 +1,47 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
#define PI 3.14159265359
const vec3 uAColor = vec3(.5,.5,.5);
const vec3 uBColor = vec3(.5,.5,.5);
const vec3 uCColor = vec3(1.,1.,1.);
const vec3 uDColor = vec3(.0,.33,.67);
//get colors from http://dev.thi.ng/gradients/
vec3 cosPalette(float t) {
return uAColor + uBColor*cos(6.28318*(uCColor*t+uDColor));
}
float circleSDF(vec2 st) {
return length(st-.5)*2.;
}
float flip(float v, float pct) {
return mix(v, 1.-v, pct);
}
float fill(float x, float size) {
return 1.-step(size, x);
}
float stroke(in float x_coor, float s, float width){
float d = step(s,x_coor+width*.5)-step(s,x_coor-width*.5);
return clamp(d, 0.,1.);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
vec3 color = vec3(0.0,0.0,0.0);
float alpha = 1.0;
vec2 off = vec2(.15,0);
float right = fill(circleSDF(st-off),.525);
float left = stroke(circleSDF(st+off),.5,.05);
color += flip(right, left);
gl_FragColor = vec4(color, alpha);
}

View File

@@ -0,0 +1,49 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
#define PI 3.14159265359
const vec3 uAColor = vec3(.5,.5,.5);
const vec3 uBColor = vec3(.5,.5,.5);
const vec3 uCColor = vec3(1.,1.,1.);
const vec3 uDColor = vec3(.0,.33,.67);
//get colors from http://dev.thi.ng/gradients/
vec3 cosPalette(float t) {
return uAColor + uBColor*cos(6.28318*(uCColor*t+uDColor));
}
//starting to refactor these so i can use them as individual snippets without dependencies
float rhombSDF(vec2 st) {
vec2 st1 = (st*2.-1.)*2.;
vec2 st2 = (vec2(st.x,1.-st.y)*2.-1.)*2.;
float triangle1 = max(abs(st1.x)*.866025+st1.y*.5,-st1.y*.5);
float triangle2 = max(abs(st2.x)*.866025+st2.y*.5,-st2.y*.5);
return max(triangle1, triangle2);
}
float fill(float x, float size) {
return 1.-step(size, x);
}
float stroke(in float x_coor, float s, float width){
float d = step(s,x_coor+width*.5)-step(s,x_coor-width*.5);
return clamp(d, 0.,1.);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
vec3 color = vec3(0.0,0.0,0.0);
float alpha = 1.0;
float sdf = rhombSDF(st);
color += fill(sdf,.425);
color += stroke(sdf, .5,.05);
color += stroke(sdf, .6,.05);
gl_FragColor = vec4(color, alpha);
}

View File

@@ -0,0 +1,50 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
#define PI 3.14159265359
const vec3 uAColor = vec3(.5,.5,.5);
const vec3 uBColor = vec3(.5,.5,.5);
const vec3 uCColor = vec3(1.,1.,1.);
const vec3 uDColor = vec3(.0,.33,.67);
//get colors from http://dev.thi.ng/gradients/
vec3 cosPalette(float t) {
return uAColor + uBColor*cos(6.28318*(uCColor*t+uDColor));
}
float triSDF(vec2 st) {
st = (st*2.-1.)*2.;
return max(abs(st.x)*.866025+st.y*.5,-st.y*.5);
}
float rhombSDF(vec2 st) {
vec2 st1 = (st*2.-1.)*2.;
vec2 st2 = (vec2(st.x,1.-st.y)*2.-1.)*2.;
float triangle1 = max(abs(st1.x)*.866025+st1.y*.5,-st1.y*.5);
float triangle2 = max(abs(st2.x)*.866025+st2.y*.5,-st2.y*.5);
return max(triangle1, triangle2);
}
float fill(float x, float size) {
return 1.-step(size, x);
}
float flip(float v, float pct) {
return mix(v, 1.-v, pct);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
vec3 color = vec3(0.0,0.0,0.0);
float alpha = 1.0;
float tri = fill(triSDF(st),.5);
float rhomb = fill(rhombSDF(st),.4);
color += flip(rhomb,tri);
gl_FragColor = vec4(color, alpha);
}

View File

@@ -0,0 +1,49 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
#define PI 3.14159265359
const vec3 uAColor = vec3(.5,.5,.5);
const vec3 uBColor = vec3(.5,.5,.5);
const vec3 uCColor = vec3(1.,1.,1.);
const vec3 uDColor = vec3(.0,.33,.67);
//get colors from http://dev.thi.ng/gradients/
vec3 cosPalette(float t) {
return uAColor + uBColor*cos(6.28318*(uCColor*t+uDColor));
}
float circleSDF(vec2 st) {
return length(st-.5)*2.;
}
float triSDF(vec2 st) {
st = (st*2.-1.)*2.;
return max(abs(st.x)*.866025+st.y*.5,-st.y*.5);
}
float stroke(in float x_coor, float s, float width){
float d = step(s,x_coor+width*.5)-step(s,x_coor-width*.5);
return clamp(d, 0.,1.);
}
float fill(float x, float size) {
return 1.-step(size, x);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
vec3 color = vec3(0.0,0.0,0.0);
float alpha = 1.0;
float circle = circleSDF(st-vec2(.0,.1));
float triangle = triSDF(st+vec2(.0,.1));
color += stroke(circle,.45,.1);
//good way to disable colors in a space. since mult 1. gives the og value but mult .0 sets to 0
color *= step(.55,triangle);
color += fill(triangle,.45);
gl_FragColor = vec4(color, alpha);
}

View File

@@ -0,0 +1,42 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
#define PI 3.14159265359
const vec3 uAColor = vec3(.5,.5,.5);
const vec3 uBColor = vec3(.5,.5,.5);
const vec3 uCColor = vec3(1.,1.,1.);
const vec3 uDColor = vec3(.0,.33,.67);
//get colors from http://dev.thi.ng/gradients/
vec3 cosPalette(float t) {
return uAColor + uBColor*cos(6.28318*(uCColor*t+uDColor));
}
float fill(float x, float size) {
return 1.-step(size, x);
}
//wtf even
float triSDF(vec2 st) {
st = (st*2.-1.)*2.;
return max(abs(st.x)*.866025+st.y*.5,-st.y*.5);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
vec3 color = vec3(0.0,0.0,0.0);
float alpha = 1.0;
st.y = 1.-st.y;
vec2 ts = vec2(st.x,.82-st.y);
color += fill(triSDF(st), .7);
color -= fill(triSDF(ts), .36);
gl_FragColor = vec4(color, alpha);
}

View File

@@ -0,0 +1,47 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
#define PI 3.14159265359
const vec3 uAColor = vec3(.5,.5,.5);
const vec3 uBColor = vec3(.5,.5,.5);
const vec3 uCColor = vec3(1.,1.,1.);
const vec3 uDColor = vec3(.0,.33,.67);
//get colors from http://dev.thi.ng/gradients/
vec3 cosPalette(float t) {
return uAColor + uBColor*cos(6.28318*(uCColor*t+uDColor));
}
float flip(float v, float pct) {
return mix(v, 1.-v, pct);
}
float fill(float x, float size) {
return 1.-step(size, x);
}
float stroke(in float x_coor, float s, float width){
float d = step(s,x_coor+width*.5)-step(s,x_coor-width*.5);
return clamp(d, 0.,1.);
}
float rectSDF(vec2 st, vec2 s) {
st = st*2.-1.;
return max(abs(st.x/s.x),abs(st.y/s.y));
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
vec3 color = vec3(0.0,0.0,0.0);
float alpha = 1.0;
float rect = rectSDF(st, vec2(.5,1.));
float diag = (st.x+st.y)*.5;
color += flip(fill(rect,.6),stroke(diag,.5,.01));
gl_FragColor = vec4(color, alpha);
}