<?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>Forem: Adam Laston</title>
    <description>The latest articles on Forem by Adam Laston (@ajlaston).</description>
    <link>https://forem.com/ajlaston</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%2F419112%2Fd1d1b0ca-5d13-4f32-928b-3249ea89bbe4.jpg</url>
      <title>Forem: Adam Laston</title>
      <link>https://forem.com/ajlaston</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ajlaston"/>
    <language>en</language>
    <item>
      <title>Rendering 15 Million Moving Nodes in the Browser with WebGPU</title>
      <dc:creator>Adam Laston</dc:creator>
      <pubDate>Sat, 15 Nov 2025 05:04:25 +0000</pubDate>
      <link>https://forem.com/ajlaston/rendering-15-million-moving-nodes-in-the-browser-with-webgpu-8ie</link>
      <guid>https://forem.com/ajlaston/rendering-15-million-moving-nodes-in-the-browser-with-webgpu-8ie</guid>
      <description>&lt;h2&gt;
  
  
  Rendering 15 Million Moving Nodes in Real Time with WebGPU
&lt;/h2&gt;

&lt;p&gt;I’ve been experimenting with WebGPU and wanted to see how far the modern browser GPU pipeline can be pushed.&lt;br&gt;&lt;br&gt;
The result is a benchmark that simulates and renders up to &lt;strong&gt;15,000,000 independently moving nodes&lt;/strong&gt;&lt;br&gt;
 entirely on the GPU.&lt;/p&gt;

&lt;p&gt;Demo:&lt;br&gt;&lt;br&gt;
&lt;a href="https://ajlaston.github.io/Nova-Web/" rel="noopener noreferrer"&gt;https://ajlaston.github.io/Nova-Web/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Repository:&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/ajlaston/Nova-Web" rel="noopener noreferrer"&gt;https://github.com/ajlaston/Nova-Web&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What the Demo Does
&lt;/h2&gt;

&lt;p&gt;Each node is a small rectangle with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;position (x, y)
&lt;/li&gt;
&lt;li&gt;size (w, h)
&lt;/li&gt;
&lt;li&gt;velocity (vx, vy)
&lt;/li&gt;
&lt;li&gt;color (r, g, b, a)
&lt;/li&gt;
&lt;li&gt;a &lt;code&gt;visible&lt;/code&gt; flag set by the compute shader
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All movement, boundary clamping, and visibility checks are computed in a WebGPU &lt;strong&gt;compute shader&lt;/strong&gt;, not on the CPU.&lt;/p&gt;

&lt;p&gt;A second pass uses &lt;strong&gt;indirect drawing&lt;/strong&gt;, where the compute shader writes the number of visible nodes into a buffer and the render pipeline draws exactly that many instances.&lt;/p&gt;




&lt;h2&gt;
  
  
  How It Works Internally
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Compute shader simulation
&lt;/h3&gt;

&lt;p&gt;The compute pipeline runs every frame and updates:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
wgsl
node.x += node.vx;
node.y += node.vy;

if (node.x &amp;lt; 0.0 || node.x + node.w &amp;gt; canvasSize.x) {
    node.vx = -node.vx;
}
if (node.y &amp;lt; 0.0 || node.y + node.h &amp;gt; canvasSize.y) {
    node.vy = -node.vy;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>javascript</category>
      <category>webgpu</category>
      <category>webdev</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
