<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Thanks Geoffrey.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">quote of the day "and a touch of the
nightmare that is the web development ecosystem"</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">-Mark<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 12/06/2020 9:23 PM, Geoff wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAGgbuXvuiw4jrAjqGhAZPDpj-HVnAsYzr-n4dN4M0cO+sjLfsw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Hey all,
<div><br>
</div>
<div>I recently discovered that the power of a modern GPU allows
brute-forcing <a
href="https://en.wikipedia.org/wiki/Constructive_solid_geometry"
moz-do-not-send="true">constructive solid geometry</a> (aka
how CAD programs work) on a per-pixel basis. As I know a bit
of GLSL, I endeavoured to create a small CAD program.</div>
<div><br>
</div>
<div>For those who know nothing about a GPU: you can treat it
like a CPU with a thousand cores, with the caveat that all the
cores are performing the same instruction at the same time.
Typically you write a "shader" program that gets executed for
a region on the screen.</div>
<div><br>
</div>
<div>My idea was to define primitives (box, sphere),
transformations (translate, rotate) and boolean operations
(union, intersect, difference) in a declarative language. For
example, you may say:</div>
<div>
<ul>
<li>Create An Entity</li>
<li>Move the entity 3 units along the X axis</li>
<li>The entity is a box</li>
<li>The entity should be joined to the existing entities
with a "difference" operation</li>
</ul>
</div>
<div>A mini version you can play with is available online here: <a
href="https://www.shadertoy.com/view/ttXcWH"
moz-do-not-send="true">https://www.shadertoy.com/view/ttXcWH</a> </div>
<div>The scene description begins on line 52.</div>
<div><br>
</div>
<div>Unfortunately I couldn't get the system performant enough
to be useful. I think this is because of the (by shader
standards) high amount of memory fetches required, or perhaps
the instruction cache is getting hammered? (There is zero
information on the size of the instruction cache on modern
GPU's).</div>
<div><br>
</div>
<div>Anyway, there's a random failure that failed. If I could be
bothered continuing with making a CAD program, I'd probably
dynamically generate the shader. This would be slower when you
edit the scene (as it would have to recompile the shader), but
would be faster on execution.</div>
<div><br>
</div>
<div>If nothing else, I learned a bunch of Rust, WebAssembly and
WebGL and a touch of the nightmare that is the web development
ecosystem. Full project repository <a
href="https://github.com/sdfgeoff/sdf_designer_failed"
moz-do-not-send="true">https://github.com/sdfgeoff/sdf_designer_failed</a> </div>
<div><br>
</div>
<div>Geoffrey</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Chchrobotics mailing list <a class="moz-txt-link-abbreviated" href="mailto:Chchrobotics@lists.ourshack.com">Chchrobotics@lists.ourshack.com</a>
<a class="moz-txt-link-freetext" href="https://lists.ourshack.com/mailman/listinfo/chchrobotics">https://lists.ourshack.com/mailman/listinfo/chchrobotics</a>
Mail Archives: <a class="moz-txt-link-freetext" href="http://lists.ourshack.com/pipermail/chchrobotics/">http://lists.ourshack.com/pipermail/chchrobotics/</a>
Meetings usually 3rd Monday each month. See <a class="moz-txt-link-freetext" href="http://kiwibots.org">http://kiwibots.org</a> for venue, directions and dates.
When replying, please edit your Subject line to reflect new subjects.</pre>
</blockquote>
<p><br>
</p>
</body>
</html>