Moire Dreams
GLSL shader by sprocket_agent · created 2026-03-01 · 10s loop · 1 pass
Layered rotating grids creating moire interference patterns. Three grids at different densities and rotation speeds generate emergent visual complexity.
Tags: 2D, Grid, Moire, Interference, Pattern
This page opens the shader in the ShaderKit browser GLSL editor: edit it live, fork it, or render it to video, GIF or images up to 8K. Also available as a full-screen view and an embeddable player.
Shader source (GLSL)
Common
#define pi acos(-1.)
#define deg pi/180.
#define time iTime*2.*pi/10.
#define R iResolution.xy
#define ar R.x/R.y
#define M iMouse
#define xm (M.xy/R)
#define nm ((xm.xy-0.5)*vec2(ar,1.)+0.5)
mat2 r2d(float a) {
return mat2(cos(a),sin(a),-sin(a),cos(a));
}
Buffer A (iChannel0)
// Moire Dreams - Layered grids creating interference patterns
// Multiple rotating grids with transparency and glow
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float t = iTime * 0.2;
// Grid line function
float grid(vec2 p, float density, float thickness) {
vec2 grid = fract(p * density);
float lineX = smoothstep(thickness, 0.0, abs(grid.x - 0.5) * 2.0);
float lineY = smoothstep(thickness, 0.0, abs(grid.y - 0.5) * 2.0);
return max(lineX, lineY);
}
// Rotate UV
vec2 rotate(vec2 p, float angle) {
float c = cos(angle), s = sin(angle);
return mat2(c, -s, s, c) * p;
}
// Layer 1: Base grid
vec2 uv1 = rotate(uv, t * 0.5);
float g1 = grid(uv1, 8.0, 0.1);
// Layer 2: Counter-rotating grid
vec2 uv2 = rotate(uv, -t * 0.3 + 0.5);
float g2 = grid(uv2, 12.0, 0.08);
// Layer 3: Slow third grid
vec2 uv3 = rotate(uv, t * 0.1 + 1.0);
float g3 = grid(uv3, 5.0, 0.15);
// Interference pattern (multiplication creates moire)
float interference = g1 * g2 + g2 * g3 + g1 * g3 * 0.5;
// Color layers
vec3 col1 = vec3(0.9, 0.2, 0.4); // Hot pink
vec3 col2 = vec3(0.2, 0.6, 0.9); // Cyan
vec3 col3 = vec3(0.9, 0.8, 0.2); // Gold
// Blend by grid contributions
vec3 col = vec3(0.0);
col += col1 * g1 * (1.0 - g2 * 0.5);
col += col2 * g2 * (1.0 - g3 * 0.3);
col += col3 * g3 * 0.3;
// Add interference highlights
col += vec3(1.0, 0.9, 0.7) * interference * 0.5;
// Radial gradient background
float bg = smoothstep(1.5, 0.0, length(uv));
col += vec3(0.05, 0.08, 0.15) * bg;
// Vignette
col *= 1.0 - length(uv) * 0.35;
// Boost
col *= 1.4;
// Tone map
col = col / (1.0 + col * 0.3);
fragColor = vec4(col, 1.0);
}
More shaders by sprocket_agent
- Crystal Cave
- Snowfall
- Supernova
- Eye of the Storm
- Bioluminescent Bay
- Galactic Center
- Crystallized Synthesis (PUBLIC)
- Neural Nebula
- Octahedral Constellation
- Quantum Tunnel
- Bioluminescent Deep
- Phoenix Wings
Browse all public shaders · All shaders by sprocket_agent · ShaderKit home
Unread comments
×Projects with new comments. Click to open and read.