<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/drawing-with-light-an-exploration-of-lit-gpu-tubes-with-tsl-and-webgpu-hcfish0ru" -->

---
title: Drawing With Light: An Exploration of Lit GPU Tubes with...
description: A deep technical walkthrough of building a GPU-driven tube renderer in three.js using TSL and WebGPU, aimed at rendering lit, volumetric strand-like geometry...
canonical: https://daily.dev/posts/drawing-with-light-an-exploration-of-lit-gpu-tubes-with-tsl-and-webgpu-hcfish0ru
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Drawing With Light: An Exploration of Lit GPU Tubes with TSL and WebGPU | daily.dev
og:description: A deep technical walkthrough of building a GPU-driven tube renderer in three.js using TSL and WebGPU, aimed at rendering lit, volumetric strand-like geometry...
og:url: https://daily.dev/posts/drawing-with-light-an-exploration-of-lit-gpu-tubes-with-tsl-and-webgpu-hcfish0ru
og:image: https://api.daily.dev/og/posts/hCFish0RU.png
og:image:alt: Drawing With Light: An Exploration of Lit GPU Tubes with TSL and WebGPU
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Drawing With Light: An Exploration of Lit GPU Tubes with TSL and WebGPU

**[Codrops](https://daily.dev/sources/codrops)** · 16 min read · 0 upvotes · 0 comments

## Summary

A deep technical walkthrough of building a GPU-driven tube renderer in three.js using TSL and WebGPU, aimed at rendering lit, volumetric strand-like geometry (used to draw hands made of thread). The approach uploads a static parameter grid (progress/angle) and computes positions and normals entirely on the GPU via a curve-sampling function, letting the tube ride on MeshStandardNodeMaterial for full PBR lighting without ever rebuilding geometry. A large section documents three failed attempts at building a per-vertex reference frame for the tube's cross-section (Duff's branchless orthonormal basis, axis blending, and least-aligned-axis selection), each producing different visual artifacts, before landing on a fixed-axis cross product justified by the hairy ball theorem. Also covers authoring curves via Catmull-Rom splines from storage buffers, generating strand geometry by walking a mesh's geodesic distance field from Dijkstra passes, and several smaller techniques for load-in animation, selective bloom via MRT, screen-space interaction, and frame-rate-independent camera easing.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://tympanus.net/codrops/2026/09/07/drawing-with-light-an-exploration-of-lit-gpu-tubes-with-tsl-and-webgpu>

## Questions this post answers

### Why does the Pixar/Duff branchless orthonormal basis method produce twisted or pinched geometry on a tube along a curve?

The Duff branchless orthonormal basis formula contains a sign(tangent.z) term, so the computed frame flips whenever the curve's tangent crosses the tangent.z = 0 plane. Two neighboring rings straddling that plane end up 180 degrees twisted relative to each other, pinching the connecting quad into a bow-tie shape. On a helix with two turns, this happens at exactly four points where tangent.z crosses zero.

_Developers debugging shader frame artifacts can find deep implementation writeups like this on daily.dev._

### How can I render animated tube geometry in three.js WebGPU without rebuilding the mesh every frame?

Upload a static grid encoding only 'progress' (0 to 1 along the curve) and 'angle' (0 to 2π around the cross-section) per vertex, with zeroed positions and normals. At render time, a TSL positionNode samples a curve function at progress plus/minus an epsilon to derive the tangent via central difference, builds a cross-section frame from a fixed reference axis, and computes the final position and normal entirely on the GPU, so the CPU never re-uploads vertices.

_Anyone optimizing GPU-driven geometry pipelines in three.js can track techniques like this on daily.dev._

### Is it possible to build a perfectly continuous, non-degenerate frame for every possible tangent direction along a 3D curve?

No, it is mathematically impossible: the hairy ball theorem guarantees any stateless rule mapping a tangent direction to a perpendicular frame must break somewhere on the sphere of directions. The practical fix is not eliminating the singularity but choosing where it sits, for example using a fixed +Z reference axis so the singularity only occurs when a curve's tangent runs exactly parallel to that axis, which strand-like content rarely does.

_Developers wrestling with vector math edge cases in shader work can follow deep dives like this on daily.dev._

## Similar posts on daily.dev

- [Exploring Procedural Geometry with Three.js and WebGPU](https://daily.dev/posts/exploring-procedural-geometry-with-three-js-and-webgpu-fmy1y3gze) · Codrops · 1 upvotes · 0 comments
- [Building an Infinite Liquid Glass Grid with Three.js, WebGPU, and TSL](https://daily.dev/posts/building-an-infinite-liquid-glass-grid-with-three-js-webgpu-and-tsl-cwvx0gsr8) · Codrops · 9 upvotes · 1 comments
- [Fascinating Particle Simulation Created with WebGPU](https://daily.dev/posts/fascinating-particle-simulation-created-with-webgpu-q0z5bb1e6) · 80 LEVEL · 0 upvotes · 0 comments
- [Graphics Programming weekly - Issue 441 - May 17th, 2026](https://daily.dev/posts/graphics-programming-weekly---issue-441---may-17th-2026-nv4blbhqv) · Jendrik Illner · 2 upvotes · 0 comments
- [THREE.js-PathTracing-Renderer](https://daily.dev/posts/three-js-pathtracing-renderer-f7kf7vkhm) · Hacker News · 3 upvotes · 0 comments

---

Tags: [#game-development](https://daily.dev/tags/game-development), [#threejs](https://daily.dev/tags/threejs), [#webgpu](https://daily.dev/tags/webgpu), [#creative-coding](https://daily.dev/tags/creative-coding)

[View this post on daily.dev](https://daily.dev/posts/drawing-with-light-an-exploration-of-lit-gpu-tubes-with-tsl-and-webgpu-hcfish0ru)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Drawing With Light: An Exploration of Lit GPU Tubes with TSL and WebGPU","url":"https://daily.dev/posts/drawing-with-light-an-exploration-of-lit-gpu-tubes-with-tsl-and-webgpu-hcfish0ru","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/drawing-with-light-an-exploration-of-lit-gpu-tubes-with-tsl-and-webgpu-hcfish0ru"},"datePublished":"2026-09-07T14:02:15.170Z","dateModified":"2026-09-07T16:00:24.804Z","description":"A deep technical walkthrough of building a GPU-driven tube renderer in three.js using TSL and WebGPU, aimed at rendering lit, volumetric strand-like geometry...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/70ab863c19d33b7f2fd9d79c12b9ce4f?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/70ab863c19d33b7f2fd9d79c12b9ce4f?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Codrops","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Codrops","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/codrops","url":"https://daily.dev/sources/codrops"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/drawing-with-light-an-exploration-of-lit-gpu-tubes-with-tsl-and-webgpu-hcfish0ru","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"game-development,threejs,webgpu,creative-coding","timeRequired":"PT16M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Codrops","item":"https://daily.dev/sources/codrops"},{"@type":"ListItem","position":3,"name":"Drawing With Light: An Exploration of Lit GPU Tubes with TSL and WebGPU"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/drawing-with-light-an-exploration-of-lit-gpu-tubes-with-tsl-and-webgpu-hcfish0ru#faq","mainEntity":[{"@type":"Question","name":"Why does the Pixar/Duff branchless orthonormal basis method produce twisted or pinched geometry on a tube along a curve?","acceptedAnswer":{"@type":"Answer","text":"The Duff branchless orthonormal basis formula contains a sign(tangent.z) term, so the computed frame flips whenever the curve's tangent crosses the tangent.z = 0 plane. Two neighboring rings straddling that plane end up 180 degrees twisted relative to each other, pinching the connecting quad into a bow-tie shape. On a helix with two turns, this happens at exactly four points where tangent.z crosses zero. Developers debugging shader frame artifacts can find deep implementation writeups like this on daily.dev."}},{"@type":"Question","name":"How can I render animated tube geometry in three.js WebGPU without rebuilding the mesh every frame?","acceptedAnswer":{"@type":"Answer","text":"Upload a static grid encoding only 'progress' (0 to 1 along the curve) and 'angle' (0 to 2π around the cross-section) per vertex, with zeroed positions and normals. At render time, a TSL positionNode samples a curve function at progress plus/minus an epsilon to derive the tangent via central difference, builds a cross-section frame from a fixed reference axis, and computes the final position and normal entirely on the GPU, so the CPU never re-uploads vertices. Anyone optimizing GPU-driven geometry pipelines in three.js can track techniques like this on daily.dev."}},{"@type":"Question","name":"Is it possible to build a perfectly continuous, non-degenerate frame for every possible tangent direction along a 3D curve?","acceptedAnswer":{"@type":"Answer","text":"No, it is mathematically impossible: the hairy ball theorem guarantees any stateless rule mapping a tangent direction to a perpendicular frame must break somewhere on the sphere of directions. The practical fix is not eliminating the singularity but choosing where it sits, for example using a fixed +Z reference axis so the singularity only occurs when a curve's tangent runs exactly parallel to that axis, which strand-like content rarely does. Developers wrestling with vector math edge cases in shader work can follow deep dives like this on daily.dev."}}]}
```

