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;
      
      vec2 rotate2D(vec2 p, float angle) {
          float s = sin(angle), c = cos(angle);
          return mat2(c, -s, s, c) * p;
      }
      
      float sdBox(vec2 p, vec2 b) {
          vec2 d = abs(p) - b;
          return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);
      }
      
      vec3 getRainbow(float t) {
          return 0.5 + 0.5 * cos(6.28318 * (t + vec3(0.0, 0.33, 0.67)));
      }
      
      float hash(vec2 p) {
          return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
      }
      
      void main() {
          vec2 uv = v_uv;
          vec2 aspect = vec2(u_resolution.x/u_resolution.y, 1.0);
          uv = (uv - 0.5) * aspect;
          
          float mouseInfluence = 1.0 - length(u_mouse - v_uv) * 2.0;
          mouseInfluence = clamp(mouseInfluence, 0.0, 1.0);
          
          vec2 grid = rotate2D(uv, 0.785398);
          grid *= 8.0 + mouseInfluence * 2.0;
          
          vec2 id = floor(grid);
          vec2 gv = fract(grid) - 0.5;
          
          float d = sdBox(gv, vec2(0.3));
          float cellNoise = hash(id + floor(u_time));
          
          vec3 color = getRainbow(length(id) * 0.1 + u_time * 0.2);
          
          float glassEffect = smoothstep(0.1, -0.1, d);
          glassEffect *= 0.8 + 0.2 * sin(cellNoise * 6.28318 + u_time * 2.0);
          
          vec3 finalColor = mix(color, vec3(1.0), glassEffect * 0.3);
          finalColor = mix(finalColor, color * 1.5, mouseInfluence * 0.5);
          
          float edge = smoothstep(0.01, 0.0, abs(d));
          finalColor += edge * 0.2;
          
          gl_FragColor = vec4(finalColor, 1.0);
          
          #include <colorspace_fragment>
      }