- Published on
Shaders #2: Hidden patterns
- Authors

- Name
- Rob
- @x
Prompt
Create a GLSL (Shadertoy) script to express the hidden patterns that drive our reality. Then, explain why you designed it this way.
Output 1
Here's a GLSL shader that visualizes the hidden patterns of reality using cellular automata, vortex flow, and recursive warping effects. This approach represents the idea that reality emerges from simple rules leading to complex structures.
Concept & Symbolism
- Cellular Automata-Like Transformation: Reality might emerge from simple rules creating complex behavior, much like cellular automata. The recursive transformation of p = abs(p) / dot(p, p) - 0.75 creates self-organizing structures.
- Vortex Flow Representation: The flow distortion suggests the unseen forces that shape reality (gravitational fields, time warping).
- Recursive Warping for Hidden Order: The use of sin() and cos() warps creates self-similar, yet chaotic formations, representing the interplay between order and randomness.
- Dynamic Color Mapping as Energy Fields: The oscillating color spectrum reflects energy fields and shifting structures in space-time.
Why This Approach?
This shader presents reality as an evolving, self-organizing field, hinting at hidden structures guiding its flow.
Code
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
// Normalize coordinates to range [-1, 1] based on resolution
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
// Animate over time
float time = iTime * 0.5;
// Scale factor for pattern distortion
float scale = 2.0;
float pattern = 0.0;
// Iterative pattern generation using symmetry and sine waves
for (int i = 0; i < 10; i++) {
uv = abs(uv) * scale - vec2(1.0); // Mirroring and scaling effect
pattern += sin(uv.x * 4.0 + time) * sin(uv.y * 4.0 - time); // Layered sine waves
}
// Adjust pattern for smooth color transitions
pattern = sin(pattern * 3.14);
// Generate color using sine-based palette
vec3 color = 0.5 + 0.5 * cos(pattern + vec3(0.0, 2.0, 4.0));
// Output final color with full opacity
fragColor = vec4(color, 1.0);
}
Output 2
Below is a GLSL (Shadertoy) script that uses an iterative fractal “folding” process and time‐dependent rotations/color shifts. I designed it to evoke the idea that complex, hidden patterns—like those found in fractals—can emerge from very simple, repeated rules. These patterns, constantly shifting with time, are a metaphor for the dynamic yet ordered structures underlying our reality.
Concept & Design
This shader is designed to represent cosmic wave interactions, drawing inspiration from fundamental physical phenomena such as wave propagation, quantum structures, and chaotic dynamics. Here’s why each element was chosen:
Radial Wave Propagation - This simulates the way energy disperses from a point source, akin to ripples in a pond or cosmic waves expanding through space. The function sin(length(uv) * 10.0 - time) creates a periodic wave effect that gives a sense of continuous movement.
Quantum Grid Distortion - This layer represents structured patterns found in quantum mechanics, where grids and interference play a role in probability fields. The floor(uv _ 10.0) operation breaks space into discrete grid-like sections, while sin(grid.x _ grid.y * 30.0 + time) introduces oscillatory distortions.
Chaotic Pulse Dynamics - The pulses are designed to reflect unpredictable yet mathematically bound interactions, mimicking turbulence and emergent behavior in complex systems. The nested sine and cosine waves create interference-like patterns, hinting at the duality of order and chaos.
Color Composition - The final color blend (vec3(radialWave, gridEffect, pulse) * 0.7 + 0.3) ensures that all three components contribute to the output. The color scheme shifts dynamically, making the visualization feel alive, much like cosmic radiation patterns.
Why This Approach?
This shader was designed to convey the hidden structure of reality—from the macroscopic expansion of the universe to microscopic quantum fluctuations. By layering deterministic waves, structured grids, and chaotic pulses, it mirrors the intricate balance between order and randomness that governs the physical world.
Code
// A fractal function that repeatedly folds and scales the coordinate space,
// capturing the notion of self-similarity and infinite complexity.
float fractal(in vec2 uv) {
float scale = 1.0;
float accum = 0.0;
for (int i = 0; i < 10; i++) {
// Fold the space to create symmetry:
uv = abs(uv);
// Swap components if needed to enhance the pattern:
if (uv.x < uv.y) uv = vec2(uv.y, uv.x);
// Scale and translate:
uv = uv * 1.5 - vec2(1.0);
// Accumulate a contribution that decays with distance:
accum += exp(-length(uv) * scale);
scale *= 1.2;
}
return accum;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
// Normalize coordinates and center them, preserving aspect ratio.
vec2 uv = (fragCoord.xy - 0.5 * iResolution.xy) / iResolution.y;
// Rotate the coordinate system over time to simulate cosmic motion.
float angle = iTime * 0.2;
mat2 rot = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));
uv = rot * uv;
// Slightly perturb the input with a time-based sine offset.
float f = fractal(uv + 0.2 * sin(iTime));
// Map the fractal output to a dynamic color palette,
// with sine and cosine functions echoing the rhythmic pulse of underlying forces.
vec3 col = vec3(
0.5 + 0.5 * sin(3.0 * f + iTime),
0.5 + 0.5 * cos(5.0 * f - iTime),
0.5 + 0.5 * sin(7.0 * f + iTime)
);
fragColor = vec4(col, 1.0);
}
Output 3
The Eternal Fractal, a shader that represents reality as an infinite recursive structure, where every layer reveals a deeper hidden order. This design suggests that existence itself is a self-replicating pattern, from the microscopic to the cosmic scale, mirroring concepts from fractal geometry, sacred patterns, and the infinite nature of consciousness.
Concept & Symbolism
Recursive Fractal Structure (Infinity Hidden in Reality) -The fractal recursion suggests that reality is built upon self-replicating mathematical principles, found in nature (trees, coastlines, neurons) and the cosmos (galaxies, dark matter networks).
Radial Symmetry (Sacred Geometry & Universal Order) - The symmetry resembles mandalas, flower-of-life patterns, and atomic structures, reinforcing the idea that existence follows deeply ingrained mathematical harmonies.
Noise (Entropy & Chaos in the System) - Random noise introduces an unpredictable aspect, reflecting how disorder and randomness coexist with structured order in reality.
Glow Effect (Mysticism & Cosmic Awareness) - The subtle glow around the pattern makes the shader feel ethereal, as if the fractal represents an underlying cosmic energy field or a higher-dimensional projection of reality.
Time Evolution (Unfolding Reality in Motion) - The fractal constantly evolves, symbolizing that existence is not static but in a continuous state of unfolding and self-replication.
Why This Approach?
This shader presents reality as an infinite, evolving fractal, where everything is a pattern within a pattern, endlessly recursive. It hints at a hidden structure—perhaps the "code of the universe"—that gives rise to everything we experience, from galaxies to thought patterns.
Code
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
// Time-driven evolution of the fractal
float time = iTime * 0.2;
// Recursive distortion creating the fractal effect
vec2 p = uv;
float fractalPattern = 0.0;
for (int i = 0; i < 8; i++) {
p = abs(p) / dot(p, p) - 0.6;
fractalPattern += sin(p.x * 3.0 + p.y * 3.0 + time) * 0.3;
}
// Radial symmetry effect, like a mandala or sacred geometry
float radial = sin(length(uv) * 10.0 + time) * 0.5;
// Cosmic noise, adding a sense of randomness within the pattern
float noise = fract(sin(dot(uv, vec2(12.9898,78.233))) * 43758.5453);
// Merging elements into a dynamic fractal field
float pattern = mix(fractalPattern, radial, 0.6) + noise * 0.2;
// Generating deep-space colors, shifting over time
vec3 col = 0.5 + 0.5 * cos(6.28318 * vec3(0.2, 0.5, 0.8) * pattern + time);
// Ethereal glow, enhancing the fractal depth
float glow = exp(-length(uv) * 3.0) * 0.3;
fragColor = vec4(col + glow, 1.0);
}