3 comments

  • jesse__9 minutes ago
    I owe iq so much; he&#x27;s a living legend. Inigo, if you happen to ever read this, thanks so much for all the work you&#x27;ve published. Your Youtube videos sparked an interest in graphics I never knew I had.<p>For anyone that&#x27;s unfamiliar, his Youtube videos are extremely well put together, and well worth the handful of hours to watch.<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;c&#x2F;InigoQuilez" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;c&#x2F;InigoQuilez</a>
  • Lerc1 hour ago
    Can you freely compose signed distance functions? Obviously people use them for + and - regularly. My intuition says you should be able to apply *, &#x2F; and more as well.<p>and sqrt( sdEquilateralTriangle(pos.xy, 10)**2 + sdCircle(pos.xz,10)**2 )<p>seems like there&#x27;s scope for a nice little domain specific language to.<p>I think it would be interesting to have some composite operations that did probabilistic branching based upon a hashing RNG to conditionally combine shapes<p>something like<p><pre><code> float thingy(pos,r) { float more = infinity float pseudoRandom = HashToUnit(pos) if (pseudoRandom &gt;0.5) { float direction=randomAngleFromSeed(pseudoRandom+r) more = thingy(pos+direction*r, r*0.75) } return min(circle(pos,r),more) }</code></pre>
    • sebastianmestre1 hour ago
      You can take the minimum of two SDFs, which more or less gives you an SDF for their union. The maximum is the intersection. A few years ago I wrote a DSL that writes the SDFs for you, for my university programming languages course. <a href="https:&#x2F;&#x2F;github.com&#x2F;SebastianMestre&#x2F;school&#x2F;tree&#x2F;master&#x2F;university&#x2F;sdf-dsl" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;SebastianMestre&#x2F;school&#x2F;tree&#x2F;master&#x2F;univer...</a>
    • Sharlin31 minutes ago
      f * g is a symmetric difference (all zeros remain zeros, the new internal points are those that are inside exactly one of f and g: (-, +) -&gt; -, (+, -) -&gt; -, (+, +) -&gt; +, (-, -) -&gt; +).<p>f * g + x for some small constant x makes the symdiff smoother, depending on the sign of x it makes the components either meld together or &quot;repel&quot; each other. If the original components are disjoint (or if it&#x27;s 3D solids and the internal surfaces are irrelevant) and x &lt; 0, it functions as a smooth union.<p>f &#x2F; g has the same inside&#x2F;zero&#x2F;outside behavior as f * g, but is of course very pathological for all values of g close to zero. I don&#x27;t think it has any good uses.
  • on_the_train2 hours ago
    I come back every couple of months when I have a new project involving sdfs. And almost every time it&#x27;s a bit of trial and error figuring out the parameters. It&#x27;s workable, but a minor pet peeve that they&#x27;re not described or named better.<p>It&#x27;s a priceless resource nevertheless.
    • RogerL2 hours ago
      I was just about to say the same thing. This is bad code&#x2F;documentation. Single letter variable names is almost always wrong if it isn&#x27;t i for an index or such (and even then, would typing &#x27;idx&#x27; kill you?). And as parameters, so much worse. Don&#x27;t make me guess how to call your function please.