new sketches and naming convention
parent
a4ebc30397
commit
a06dc9babc
@ -0,0 +1,55 @@
|
|||||||
|
// Based on: https://thebookofshaders.com/edit.php#11/simplex-grid.frag
|
||||||
|
// Title: Labor Zionism
|
||||||
|
// Author Leo Coogan - 2025 - https://existential.beauty
|
||||||
|
// Author @patriciogv - 2015 - patriciogonzalezvivo.com
|
||||||
|
|
||||||
|
#ifdef GL_ES
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uniform vec2 u_resolution;
|
||||||
|
uniform vec2 u_mouse;
|
||||||
|
uniform float u_time;
|
||||||
|
|
||||||
|
vec2 skew (vec2 st) {
|
||||||
|
vec2 r = vec2(1.0);
|
||||||
|
r.x = 0.1*st.x;
|
||||||
|
r.y = st.y+0.5*r.x;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 simplexGrid (vec2 st) {
|
||||||
|
vec3 xyz = vec3(0.0);
|
||||||
|
|
||||||
|
vec2 p = fract(skew(st));
|
||||||
|
if (p.x > p.y) {
|
||||||
|
xyz.xy = 1.0-vec2(p.x,p.y-p.x);
|
||||||
|
xyz.z = p.y;
|
||||||
|
} else {
|
||||||
|
xyz.yz = 1.0-vec2(p.x-p.y,p.y);
|
||||||
|
xyz.x = p.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fract(xyz);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 st = gl_FragCoord.xy/u_resolution.xy;
|
||||||
|
vec3 color = vec3(1.0);
|
||||||
|
|
||||||
|
// Scale the space to see the grid
|
||||||
|
st *= 11.184 + u_time - 0.9 ;
|
||||||
|
|
||||||
|
// Show the 2D grid
|
||||||
|
color.bg = fract(sin(st * u_time * 0.3 + st.x)) + fract(cos(st * u_time * 0.01 + st.x));
|
||||||
|
|
||||||
|
// Skew the 2D grid
|
||||||
|
color.rg = fract(skew(st * u_time));
|
||||||
|
|
||||||
|
// Subdivide the grid into to equilateral triangles
|
||||||
|
// color = simplexGrid(st);
|
||||||
|
|
||||||
|
|
||||||
|
gl_FragColor = vec4(color,1.0);
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
// Based on: https://thebookofshaders.com/edit.php#11/simplex-grid.frag
|
||||||
|
// Title: Shader Example
|
||||||
|
// Author Leo Coogan - 2025 - https://existential.beauty
|
||||||
|
// Author @patriciogv - 2015 - patriciogonzalezvivo.com
|
||||||
|
|
||||||
|
#ifdef GL_ES
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uniform vec2 u_resolution;
|
||||||
|
uniform vec2 u_mouse;
|
||||||
|
uniform float u_time;
|
||||||
|
|
||||||
|
vec2 skew (vec2 st) {
|
||||||
|
vec2 r = vec2(0.0);
|
||||||
|
r.x = 0.001*st.x;
|
||||||
|
r.y = st.y+0.5*r.x;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 simplexGrid (vec2 st) {
|
||||||
|
vec3 xyz = vec3(0.0);
|
||||||
|
|
||||||
|
vec2 p = fract(skew(st));
|
||||||
|
if (p.x > p.y) {
|
||||||
|
xyz.xy = 1.0-vec2(p.x,p.y-p.x);
|
||||||
|
xyz.z = p.y;
|
||||||
|
} else {
|
||||||
|
xyz.yz = 1.0-vec2(p.x-p.y,p.y);
|
||||||
|
xyz.x = p.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fract(xyz);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
vec2 st = gl_FragCoord.xy/u_resolution.xy;
|
||||||
|
vec3 color = vec3(1.0);
|
||||||
|
|
||||||
|
// Scale the space to see the grid
|
||||||
|
st *= 11.184 + u_time * 0.001;
|
||||||
|
|
||||||
|
// Show the 2D grid
|
||||||
|
color.rg = fract(sin(st * u_time * 0.3 + st.y)) + fract(cos(st * u_time * 0.1 + st.y));
|
||||||
|
|
||||||
|
// Skew the 2D grid
|
||||||
|
// color.rg = fract(skew(st));
|
||||||
|
|
||||||
|
// Subdivide the grid into to equilateral triangles
|
||||||
|
// color = simplexGrid(st);
|
||||||
|
|
||||||
|
gl_FragColor = vec4(color,1.0);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue