<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Akshat Patil on Medium]]></title>
        <description><![CDATA[Stories by Akshat Patil on Medium]]></description>
        <link>https://medium.com/@akshatp439?source=rss-b74bd11b6adb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VFqMSQOt7AOlPLp1x91-EQ.jpeg</url>
            <title>Stories by Akshat Patil on Medium</title>
            <link>https://medium.com/@akshatp439?source=rss-b74bd11b6adb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 22:06:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akshatp439/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Drawing a Forest in One Line: A Preview of Instancing in p5.strands]]></title>
            <link>https://medium.com/processing-foundation/drawing-a-forest-in-one-line-a-preview-of-instancing-in-p5-strands-a2e93f9c9e04?source=rss-b74bd11b6adb------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2e93f9c9e04</guid>
            <category><![CDATA[graphics]]></category>
            <category><![CDATA[creative-coding]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Akshat Patil]]></dc:creator>
            <pubDate>Mon, 10 Aug 2026 14:21:16 GMT</pubDate>
            <atom:updated>2026-08-10T14:21:16.145Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Akshat Patil is a 19 year old computer science undergraduate from Indore, India, who enjoys building where graphics, creative coding, and open source meet. As an </em><a href="https://processingfoundation.org/dev/open-source-software-microgrant-program"><em>Open Source Software Micrograntee</em></a><em>,</em> <em>he worked on p5.strands, WebGL, WebGPU, testing infrastructure, and rendering features. He is particularly interested in making powerful graphics tools more accessible and exploring the future of creative coding on the web. Support made possible through Generative Art Foundation. Written by Akshat Patil.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*Z6lxCRsIcDLSj8w6CXohKg.png" /><figcaption>800 trees, two draw calls, made with the new instancing API</figcaption></figure><p>What if drawing a thousand shapes only took one line? p5.js v2 introduces a new graphics pipeline called<a href="https://beta.p5js.org/contribute/p5.strands/"> p5.strands</a> that runs on modern <a href="https://en.wikipedia.org/wiki/Graphics_processing_unit">GPU</a> technology by using <a href="https://medium.com/@ProcessingOrg/p5-js-2-1-and-2-2-expanding-graphics-avenues-with-p5-strands-improvements-and-webgpu-9771d40c8b1d">WebGPU</a> where possible and WebGL everywhere else. It allows creators to use the power of the GPU without having to think like a graphics programmer. As an Open Source Software Micrograntee, I helped build a beginner-friendly function that draws many copies of a shape which will be released in p5.js 2.4.</p><h3>The Problem</h3><p>Imagine drawing a forest. Every tree is roughly the same shape. If you draw 1,000 trees in a loop, your sketch sends the GPU 1,000 separate drawing instructions, one per tree, and all that back-and-forth slows things down. Instancing lets you say something different: “here is one tree, draw it 1,000 times.” The GPU receives a single instruction and produces all the copies itself, in parallel. It is the same trick games use for grass, crowds, and stars.</p><p>With the new API, instancing looks like this:</p><pre>instances(500).sphere(20);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*uTgt4BGj1c9vKpyRpgIgnA.png" /><figcaption>coming in p5.js 2.4</figcaption></figure><p>One line, 500 spheres, a single draw call. Inside a shader, each copy can read instanceIndex, its own number in the sequence, and use it to position or color itself differently.</p><h3>Why redesign it?</h3><p>p5.js already supported instancing, but through retained geometry: buildGeometry(), then model(), then instanceID() in a shader to tell copies apart. It is powerful, but previously you had to learn several new concepts before drawing your first batch of shapes. That is a lot to ask of someone who wants 500 spheres on screen. The project was not about inventing a technique — instancing already existed. The challenge was designing an API that feels like the rest of p5.js.</p><h3>Most of the work was not code</h3><p>The surprising part is how little time went into the final implementation. Most of it went into design: reading the renderer internals, studying how other libraries handle instancing, sketching options in<a href="https://www.tldraw.com/f/nKqrNyqWS-8fIyC-Zcqo-?d=v-675.-363.3241.1914.page"> tldraw diagrams</a>, and writing design documents other people could react to.</p><p>And the discussions never stopped. From the first week, ideas moved through Discord threads and GitHub reviews, and I talked with Dave Pagurek and Kit Kuksenok throughout the project. Every round made the API simpler, until the final API looks nothing like my first draft. That is exactly how it should be.</p><p>Reviews shaped the naming, the documentation, the examples, and the tests for both WebGL and WebGPU. Even a name changed along the way: instanceID() became instanceIndex, partly to match what WebGPU and other libraries call it, and partly because “index” gives beginners the right mental model, a number in a sequence rather than a unique ID.</p><p>To me, that is the real lesson: open-source features are not written, they are negotiated. A good API is a conversation that happens to end in code.</p><p>The new instancing API is now merged and lands in p5.js 2.4. If you have ever wanted to fill a canvas with a thousand copies of something, it will soon take one line. And if you want to help shape how p5.js works, the Processing Foundation Microgrant Program is a great place to start.</p><p>For readers who want the deeper technical story, the<a href="https://github.com/processing/p5.js/issues/8911"> tracking issue</a> and the<a href="https://gist.github.com/aashu2006/ca13773766637bb22785f16a475b0be1"> design proposal</a> show how the API evolved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2e93f9c9e04" width="1" height="1" alt=""><hr><p><a href="https://medium.com/processing-foundation/drawing-a-forest-in-one-line-a-preview-of-instancing-in-p5-strands-a2e93f9c9e04">Drawing a Forest in One Line: A Preview of Instancing in p5.strands</a> was originally published in <a href="https://medium.com/processing-foundation">Processing Foundation</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>