title: How to render a smooth ellipse?
body: <p>I'm trying to render an ellipse where I can decide how hard the edge is.
  (It should also be tileable, i.e. I must be able to split the rendering into multiple textures with a given offset)</p>
  <p>I came up with this:</p>
  <pre class="lang-c prettyprint-override"><code>float inEllipseSmooth(vec2 pos, float width, float height, float smoothness, float tiling, vec2 offset)
  {
      pos = pos / iResolution.xy;
      float smoothnessSqr = smoothness * tiling * smoothness * tiling;
  
      vec2 center = -offset + tiling / 2.0;
      pos -= center;
  
      float x = (pos.x * pos.x + smoothnessSqr) / (width * width);
      float y = (pos.y * pos.y  + smoothnessSqr) / (height * height);
      float result = (x + y);
  
      return (tiling * tiling) - result;
  }
  </code></pre>
  <p>See here (<strong>was updated after comment -&gt; now it's how I needed it</strong>):
  <a href="https://www.shadertoy.com/view/ssGBDK" rel="nofollow noreferrer">https://www.shadertoy.com/view/ssGBDK</a></p>
  <p>But at the moment it is not possible to get a completely hard edge. It's also smooth if &quot;smoothness&quot; is set to 0.</p>
  <p>One idea was &quot;calculating the distance of the position to the center and comparing that to the corresponding radius&quot;, but I think there is probably a better solution.</p>
  <p>I was not able to find anything online, maybe I'm just searching for the wrong keywords.</p>
  <p>Any help would be appreciated.</p>