title: Coloring rectangle in function of distance to nearest edge produces weird result in diagonals
body: <p>I'm trying to color a rectangle in ShaderToy/GLSL in function of each pixel's distance to the nearest rectangle edge. However, a weird (darker) result can be seen on its diagonals:
  <a href="https://i.stack.imgur.com/ycpJ1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ycpJ1.png" alt="vec3 mate=vec3(maxc);"></a></p>
  
  <p>I'm using the rectangle UV coordinates for it, with the following piece of code:</p>
  
  <pre><code>void mainImage( out vec4 fragColor, in vec2 fragCoord )
  {
      // Normalized pixel coordinates (from 0 to 1)
      vec2 uv = fragCoord/iResolution.xy;
  
      vec2 uvn=abs(uv-0.5)*2.0;
      float maxc=max(uvn.y,uvn.x);
  
      vec3 mate=vec3(maxc);
  
      fragColor = vec4(mate.xyz,1);
  }
  </code></pre>
  
  <p>As you can see, the error seems to come from the <code>max(uvn.y,uvn.x);</code> line of code, as it doesn't interpolate smoothly the color values as one would expect. For comparison, those are the images obtained by sampling uvn.y and uvn.x instead of the maximum between those two:</p>
  
  <p><a href="https://i.stack.imgur.com/Ktybym.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ktybym.png" alt="vec3 mate=vec3(uvn.y);"></a>
  <a href="https://i.stack.imgur.com/LQh6lm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LQh6lm.png" alt="vec3 mate=vec3(uvn.x);"></a></p>
  
  <p>You can play around with the shader at this URL:
  <a href="https://www.shadertoy.com/view/ldcyWH" rel="nofollow noreferrer">https://www.shadertoy.com/view/ldcyWH</a></p>