Build GLSL shaders with natural language

Favorites

    History

      Explore

      • organic motion background
      • a kaledioscope effect with trippy patterns and colors
      • dreamscape with chromatic abberation effect where mouse is
      • dreamscape
      • isometric vector art grid
      • sun
      • smoke mist turbulent
      • a smooth rainbow gradient with colors gently flowing into eachother
      • soft rainbow gradients flowing into eachother gently
      • morphing madness
      • gentle rainbow gradient
      • swirling
      • displacement shader on image with distortion centered around the mouse. add chromatic aberration effect which grows stronger at the edges
      Explore more
      precision mediump float;
      uniform float u_time;
      uniform vec2 u_mouse;
      uniform vec2 u_resolution;
      varying vec2 v_uv;
      
      void main() {
        // Normalize and adjust aspect ratio of coordinates.
        vec2 uv = (v_uv - 0.5) * vec2(u_resolution.x / u_resolution.y, 1.0);
        
        // Create a dynamic dreamscape background using a time- and space-varying pattern.
        float pattern = sin((uv.x + uv.y) * 10.0 + u_time) * 0.5 + 0.5;
        vec3 bgColor = mix(vec3(0.1, 0.05, 0.2), vec3(0.3, 0.1, 0.4), pattern);
        
        // Determine the mouse position in our adjusted coordinate space.
        vec2 mousePos = (u_mouse - 0.5) * vec2(u_resolution.x / u_resolution.y, 1.0);
        
        // Create an animated circle that reacts to time and mouse position.
        float circleRadius = 0.15 + 0.03 * sin(u_time * 2.0);
        float distToMouse = length(uv - mousePos);
        float circleMask = smoothstep(circleRadius, circleRadius - 0.02, distToMouse);
        vec3 circleColor = vec3(0.8, 0.5, 1.0);
        
        // Mix the circle with the background based on the mask.
        vec3 colorMix = mix(bgColor, circleColor, circleMask);
        
        // Add a chromatic aberration effect by offsetting color channels relative to the mouse.
        float aberrationStrength = 0.005 + 0.01 * smoothstep(0.0, 0.5, distToMouse);
        vec2 offsetR = vec2(aberrationStrength, 0.0);
        vec2 offsetB = vec2(-aberrationStrength, 0.0);
        
        // Compute channel contributions with slight offsets.
        float maskR = smoothstep(circleRadius, circleRadius - 0.02, length(uv - (mousePos + offsetR)));
        float maskG = circleMask;
        float maskB = smoothstep(circleRadius, circleRadius - 0.02, length(uv - (mousePos + offsetB)));
        
        float r = mix(bgColor.r, circleColor.r, maskR);
        float g = mix(bgColor.g, circleColor.g, maskG);
        float b = mix(bgColor.b, circleColor.b, maskB);
        
        vec3 finalColor = vec3(r, g, b);
        
        gl_FragColor = vec4(finalColor, 1.0);
        #include <colorspace_fragment>
      }