<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Not For You</title>
    <description>The latest articles on DEV Community by Not For You (@clindsey).</description>
    <link>https://dev.to/clindsey</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F312526%2Fe30b0745-6d83-424a-b5aa-aec67a56ff1b.jpeg</url>
      <title>DEV Community: Not For You</title>
      <link>https://dev.to/clindsey</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/clindsey"/>
    <language>en</language>
    <item>
      <title>svg-sdf-art</title>
      <dc:creator>Not For You</dc:creator>
      <pubDate>Sun, 01 Feb 2026 19:50:37 +0000</pubDate>
      <link>https://dev.to/clindsey/svg-sdf-art-3cee</link>
      <guid>https://dev.to/clindsey/svg-sdf-art-3cee</guid>
      <description>&lt;p&gt;This is a high-level overview of how I make art using a pen plotter, use it as breadcrumbs on your creative adventures.  Below you'll find the working interactive version, try it yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The problem&lt;/li&gt;
&lt;li&gt;Scene to draw&lt;/li&gt;
&lt;li&gt;Layers of the output&lt;/li&gt;
&lt;li&gt;Finished drawings&lt;/li&gt;
&lt;li&gt;Try it yourself&lt;/li&gt;
&lt;li&gt;Relevant tech&lt;/li&gt;
&lt;li&gt;See also&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The problem &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;I have made some art using raymarching and SDFs, I would like to draw it on paper using my pen plotter.  Shaders produce raster images but pen plotters need vector graphics, these two are not readily compatible.  Is there a way to convert my raster image into a reasonably good looking vector version?&lt;/p&gt;

&lt;p&gt;Pen plotters don't do well with drawing raster images, that's a job for regular printers;  some details must be lost in the conversion.  Here are the important characteristics to preserve and translate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Art style should have a good sense of depth, distance and volume&lt;/li&gt;
&lt;li&gt;Minimize pen plotter ups and down, maximize continuous lines&lt;/li&gt;
&lt;li&gt;Switching from sculpting to printing should be quick and easy&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Scene to draw &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;This is the scene I have sculpted with SDFs using GLSL.  The fragment shader can output multiple views of the scene, these will be important for vectorizing the image.&lt;/p&gt;

&lt;p&gt;

&lt;iframe height="600" src="https://codepen.io/clindsey/embed/raLvBox?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;


&lt;/p&gt;

&lt;p&gt;Here's a breakdown of the different images in the carousel above -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scene&lt;/strong&gt; - This is full color version of the scene and where I spend most of my time doing the artistic SDF sculpting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Normals&lt;/strong&gt; - Shows the normals of all surfaces, useful for drawing lines that follow the surface of objects&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Distance&lt;/strong&gt; - Encodes distance in grayscale&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Object ID&lt;/strong&gt; - Every object has its own ID, helps with plotting the borders of objects within objects&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shadow&lt;/strong&gt; - Used to find the shaded regions of the image&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Layers of the output &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Using the buffers above and &lt;a href="https://d3js.org/d3-contour" rel="noopener noreferrer"&gt;D3's contours library&lt;/a&gt;, the scene is converted to SVG vector data.  Below is a view of each layer:&lt;/p&gt;

&lt;p&gt;

&lt;iframe height="600" src="https://codepen.io/clindsey/embed/yyJjLGb?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;


&lt;/p&gt;

&lt;p&gt;These are the layers that go into the final SVG canvas -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Object Outlines&lt;/strong&gt; - Based on the Object ID buffer, captures some things that &lt;em&gt;Contour Lines&lt;/em&gt; would miss&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contour Lines&lt;/strong&gt; - Uses Normals Buffer, captures faces and curves of an object.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shadow Outlines&lt;/strong&gt; - Simple outlines of the shaded regions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shadow Regions&lt;/strong&gt; - Uses cross hatching pattern to fill the shaded regions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Crawl Lines&lt;/strong&gt; - Randomly added lines that attempt to give a sense of distance and curvature to objects.  Uses Normals Buffer to follow the surface of objects.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Finished drawings &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Overall I am reasonably happy with the results.  These are a few of the scenes I've plotted -&lt;/p&gt;

&lt;p&gt;

&lt;iframe height="600" src="https://codepen.io/clindsey/embed/MYeGgqW?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;


&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it yourself &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Use the mouse to set the camera position, then press 'Generate SVG' to render the lines.  The SDF modeling is done in the HTML section, look for the &lt;code&gt;raymarchMap&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;

&lt;iframe height="600" src="https://codepen.io/clindsey/embed/OPXzxQe?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;


&lt;/p&gt;

&lt;p&gt;It's possible to download each SVG layer individually and perhaps plot them in different colors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Relevant tech &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://threejs.org/" rel="noopener noreferrer"&gt;Three.js&lt;/a&gt; - Displays the shader in the browser&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://lygia.xyz/" rel="noopener noreferrer"&gt;LYGIA Shader Library&lt;/a&gt; - Handles raymarching, SDF primitives and operations &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://d3js.org/" rel="noopener noreferrer"&gt;D3&lt;/a&gt; - Used to create SVG paths from the buffer data&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/dataarts/dat.gui" rel="noopener noreferrer"&gt;Dat.GUI&lt;/a&gt; - Easy way to make things interactive, I use it heavily in my SDF sculpting workflow&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://codepen.io" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt; - This is a static browser-based tool&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://axidraw.com/" rel="noopener noreferrer"&gt;AxiDraw v3&lt;/a&gt; - Pen plotter;  I'm working with A4 sized paper&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  See also &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://iquilezles.org/" rel="noopener noreferrer"&gt;Inigo Quilez&lt;/a&gt;, best place to learn about SDFs&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>codepen</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
