runnable fragment

202401

glsl-daily-practice generative glsl runnable fragment MIT
code snippet
precision mediump float;
#define TDOutputSwizzle(c) (c)
uniform float u_time;
uniform vec2 u_resolution;

#define fragColor gl_FragColor

void main()
{
    vec2 uv = (gl_FragCoord.xy - u_resolution / 2.0) / u_resolution.y;
    float len = length(uv);

    // Base colors with smooth transition
    float r = sin(len * 12.0 - u_time * 3.0) * 0.5 + 0.5;
runnable fragment

202402

glsl-daily-practice generative glsl runnable fragment MIT
code snippet
precision mediump float;
#define TDOutputSwizzle(c) (c)
uniform float u_time;
uniform vec2 u_resolution;

#define fragColor gl_FragColor

void main()
{
    vec2 uv = (gl_FragCoord.xy - u_resolution / 2.0) / u_resolution.y;

    float len = length(uv);

    // Base colors with smooth transition and reduced intensity
runnable fragment

202403

glsl-daily-practice generative glsl runnable fragment MIT
code snippet
precision mediump float;
#define TDOutputSwizzle(c) (c)
uniform float u_time;
uniform vec2 u_resolution;

#define fragColor gl_FragColor

void main()
{
    vec2 uv = (gl_FragCoord.xy - u_resolution / 2.0) / u_resolution.y;
    float len = length(uv);
    float angle = atan(uv.y, uv.x);
    float radius = length(uv);
runnable fragment

202404

glsl-daily-practice generative glsl runnable fragment MIT
code snippet
precision mediump float;
#define TDOutputSwizzle(c) (c)
uniform float u_time;
uniform vec2 u_resolution;

#define fragColor gl_FragColor

void main()
{
    vec2 uv = (gl_FragCoord.xy - u_resolution / 2.0) / u_resolution.y;
    float len = length(uv);
    float angle = atan(uv.y, uv.x);
    float radius = length(uv);
runnable fragment

202407

glsl-daily-practice generative glsl runnable fragment MIT
code snippet
precision mediump float;
#define TDOutputSwizzle(c) (c)
uniform float time;
uniform vec2 resolution;

#define fragColor gl_FragColor

// Function to create a kaleidoscope effect
vec2 kaleidoscope(vec2 uv, float segments) {
    float angle = atan(uv.y, uv.x);
    float radius = length(uv);
    float newAngle = mod(angle, 2.0 * 3.141592 / segments);
    return vec2(cos(newAngle), sin(newAngle)) * radius;
}
runnable fragment

202408

glsl-daily-practice generative glsl runnable fragment MIT
code snippet
precision mediump float;
uniform float time;
uniform vec2 resolution;

#define fragColor gl_FragColor

void main()
{
    vec2 uv = (gl_FragCoord.xy - 0.5 * resolution.xy) / resolution.y;

    // Dynamic scaling and rotation for the fractal over time
    float scale = 1.5 + 0.5 * sin(time * 0.2);
    float angle = time * 0.1;
    mat2 rotation = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));
runnable fragment

202409

glsl-daily-practice generative glsl runnable fragment MIT
code snippet
precision mediump float;
#define TDOutputSwizzle(c) (c)
uniform float time;
uniform vec2 resolution;

#define fragColor gl_FragColor

void main()
{
    // Normalize pixel coordinates (from 0 to 1)
    vec2 uv = gl_FragCoord.xy / resolution;

    // Move coordinates from (0,1) to (-1,1)
    uv = uv * 2.0 - 1.0;
runnable fragment

202410

glsl-daily-practice generative glsl runnable fragment MIT
code snippet
precision mediump float;
#define TDOutputSwizzle(c) (c)
uniform float time;
uniform vec2 resolution;

#define fragColor gl_FragColor

void main()
{
    // Normalize pixel coordinates (from 0 to 1)
    vec2 uv = gl_FragCoord.xy / resolution;

    // Move coordinates from (0,1) to (-1,1)
    uv = uv * 2.0 - 1.0;
runnable fragment

202411

glsl-daily-practice generative glsl runnable fragment MIT
code snippet
precision mediump float;
#define TDOutputSwizzle(c) (c)
uniform float time;
uniform vec2 resolution;

#define fragColor gl_FragColor

void main() {
    vec2 uv = (gl_FragCoord.xy - 0.5 * resolution.xy) / resolution.y;
    
    float len = length(uv);
    float angle = atan(uv.y, uv.x);

    // Increase number of segments for more intricate patterns
runnable fragment

202412

glsl-daily-practice generative glsl runnable fragment MIT
code snippet
precision mediump float;
// Enhanced Flower of Life with Multi-Layered Central Light Pulse and Bloom
uniform float time;
uniform vec2 resolution;

#define fragColor gl_FragColor

// Function to draw a glowing circle with soft edges
float drawGlowCircle(vec2 uv, vec2 center, float radius, float glowIntensity) {
    float dist = length(uv - center);
    float glow = exp(-dist * glowIntensity) * smoothstep(radius + 0.01, radius - 0.01, dist);
    return glow;
}
runnable fragment

202413

glsl-daily-practice generative glsl runnable fragment MIT
code snippet
precision mediump float;
// Refined Flower of Life with Balanced Glow and Aurora Shimmer (No Noise)
uniform float time;
uniform vec2 resolution;

#define fragColor gl_FragColor

// Function to draw a glowing circle with soft edges
float drawGlowCircle(vec2 uv, vec2 center, float radius, float glowIntensity) {
    float dist = length(uv - center);
    float glow = exp(-dist * glowIntensity) * smoothstep(radius + 0.01, radius - 0.01, dist);
    return glow * 0.5;  // Reduce overall glow intensity
}
runnable fragment

202414

glsl-daily-practice generative glsl runnable fragment MIT
code snippet
precision mediump float;
#define TDOutputSwizzle(c) (c)
uniform float u_time;
uniform vec2 u_resolution;

#define fragColor gl_FragColor

void main()
{
    vec2 uv = (gl_FragCoord.xy - u_resolution / 2.0) / u_resolution.y;
    float len = length(uv);

    // Base harmonic oscillations for radiant colors
    float baseR = sin(len * 10.0 - u_time * 1.5) * 0.5 + 0.5;