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;
      
      #define PI 3.14159265359
      
      float hash(vec2 p) {
          p = fract(p * vec2(234.34, 435.345));
          p += dot(p, p + 34.23);
          return fract(p.x * p.y);
      }
      
      float noise(vec2 p) {
          vec2 i = floor(p);
          vec2 f = fract(p);
          f = f * f * (3.0 - 2.0 * f);
          return mix(
              mix(hash(i), hash(i + vec2(1.0, 0.0)), f.x),
              mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), f.x),
              f.y
          );
      }
      
      mat2 rot2d(float a) {
          float s = sin(a);
          float c = cos(a);
          return mat2(c, -s, s, c);
      }
      
      void main() {
          vec2 uv = v_uv;
          vec2 aspect = vec2(u_resolution.x/u_resolution.y, 1.0);
          uv = (uv - 0.5) * aspect;
          
          float mouseInfluence = length(u_mouse - v_uv) * 2.0;
          
          vec3 color = vec3(0.0);
          
          for(float i = 0.0; i < 3.0; i++) {
              vec2 p = uv;
              float t = u_time * 0.5 + i * PI * 2.0 / 3.0;
              
              p *= rot2d(t * 0.3);
              p *= 1.0 + sin(t) * 0.2;
              p *= 5.0 + sin(mouseInfluence * PI) * 2.0;
              
              float n = noise(p + t);
              float n2 = noise(p * 2.0 - t);
              
              float shape = sin(n * 5.0 + t) * cos(n2 * 4.0 - t);
              shape = abs(shape);
              shape = smoothstep(0.2 + mouseInfluence * 0.3, 0.21, shape);
              
              vec3 col = vec3(0.5, 0.8, 0.9);
              if(i == 1.0) col = vec3(0.9, 0.4, 0.6);
              if(i == 2.0) col = vec3(0.3, 0.7, 0.4);
              
              color += shape * col;
          }
          
          color = mix(vec3(0.1, 0.1, 0.2), color, 1.0);
          color += noise(uv * 100.0) * 0.02;
          
          gl_FragColor = vec4(color, 1.0);
          
          #include <colorspace_fragment>
      }