// Title: Marx // Author Leo Coogan - 2025 - existential.beauty // Based on: https://thebookofshaders.com/edit.php#11/simplex-grid.frag // 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 = 1.1547*st.x; r.y = r.x+0.5*st.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(0.0); // Scale the space to see the grid st *= 30. + u_mouse * sin(0.0001 + u_time ); // Show the 2D grid color.rb = abs(st * sin(st.y)); color.rg = fract(st * sin(st.x * 0.1)); // Skew the 2D grid //color.rg = fract(skew(st)); // Subdivide the grid into to equilateral triangles //color = simplexGrid(st); // vec3 pos = vec3(st*5.0,u_time*0.5); // color = vec3(cnoise(pos)); // vec4 ixy = permute(permute(ix) + iy); gl_FragColor = vec4(color,1.0); }