# Extended TubeGeometry

**URL:** <https://discourse.threejs.org/t/extended-tubegeometry/80539>\
**Category:** Resources\
**Created:** [April 1, 2025, 4:54pm UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539 "2025-04-01T16:54:48Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [April 1, 2025, 4:54pm UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/1 "2025-04-01T16:54:48Z")

</div>

Hi community!

Another attempt to make the work with TubeGeometry more flexible.

Added two parameters: `capped` and `RGenerator`.

`capped` - boolean. Indicates, if the tube has end caps/lids. Default value is `false`.  
`RGenerator` - function. Computes tube segments’ radii and multiplies them with `radius` parameter, takes two parameters - current position along tube’s curve [0..1], current angle for a vertex in a tube segment [0..2Pi]. Default value is 1.

 ![изображение](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/8/4/8417b027b7f787ccc94c25fe9bb3d9f884a58ecc.jpeg)  
 ![изображение](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/6/6/66fe53ecd45f9aa4e87c888acf94cbfa90c06c94.jpeg)

Demo: [https://codepen.io/prisoner849/full/RNwqWLb](https://codepen.io/prisoner849/full/RNwqWLb)

---

<div class="post-metadata">

**Author:** ![PavelBoytchev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/pavelboytchev/32/38639_2.png) [@PavelBoytchev](https://discourse.threejs.org/u/PavelBoytchev)\
**Post date:** [April 1, 2025, 5:52pm UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/2 "2025-04-01T17:52:19Z")

</div>

This reminds me of when I was a child - we used to play with [glass balls](https://en.wikipedia.org/wiki/Marble_(toy)) with colorful random shapes or air bubbles inside. Everyone had their own collection and we often traded balls with each other. They looked like this:

 ![images](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/f/5/f5641abd3269723bd4e6c267c21c8d11b0ed8c1d.jpeg)

---

<div class="post-metadata">

**Author:** ![PavelBoytchev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/pavelboytchev/32/38639_2.png) [@PavelBoytchev](https://discourse.threejs.org/u/PavelBoytchev)\
**Post date:** [April 1, 2025, 6:03pm UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/3 "2025-04-01T18:03:18Z")

</div>

> [@prisoner849](#):
>
> TubeGeometry more flexible

The type of flexibility that you made is something I have never thought about. My not-so-pretty attempt for “upgrading” tube geometry in [Suica](https://boytchev.github.io/suica/) was more focused on adding a 4th dimension and using XYZR coodinates, where R is the radius. This made it possible to create a tube with varying (and spline-able) radius at different areas. A few demos: [1](https://boytchev.github.io/suica/examples/tube-dynamic-spline-radius.html), [2](https://boytchev.github.io/suica/examples/tube-dynamic.html), [3](https://boytchev.github.io/suica/examples/tube-open-closed.html), and [4](https://boytchev.github.io/suica/examples/tube-variations.html).

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [April 1, 2025, 6:08pm UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/4 "2025-04-01T18:08:45Z")

</div>

> [@PavelBoytchev](#):
>
> A few demos

Super cool! 🤩

---

<div class="post-metadata">

**Author:** ![Lukasz\_Mestales](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/lukasz_mestales/32/65638_2.png) [@Lukasz\_Mestales](https://discourse.threejs.org/u/Lukasz_Mestales)\
**Post date:** [April 1, 2025, 6:17pm UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/5 "2025-04-01T18:17:27Z")

</div>

And now you can create Demon King in Blender and animate all…

[![](https://img.youtube.com/vi/22gw_64AGKM/maxresdefault.jpg "The Cell (2/5) Movie CLIP - Demon King (2000) HD") ](https://www.youtube.com/watch?v=22gw_64AGKM)

---

<div class="post-metadata">

**Author:** ![Fennec](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fennec/32/59265_2.png) [@Fennec](https://discourse.threejs.org/u/Fennec)\
**Post date:** [April 1, 2025, 7:12pm UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/6 "2025-04-01T19:12:29Z")

</div>

Well, that escalated quickly. From extended geometry to a nostalgic trip back to my childhood! 🥹

---

<div class="post-metadata">

**Author:** ![yesbird](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yesbird/32/46097_2.png) [@yesbird](https://discourse.threejs.org/u/yesbird)\
**Post date:** [April 2, 2025, 1:19am UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/7 "2025-04-02T01:19:28Z")

</div>

Thanks for sharing - it’s very intime !  
May I use it in my [MathViewer](https://mathview.yesbird.online/) ?

---

<div class="post-metadata">

**Author:** ![vielzutun.ch](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/vielzutun.ch/32/21366_2.png) [@vielzutun.ch](https://discourse.threejs.org/u/vielzutun.ch)\
**Post date:** [April 2, 2025, 5:32am UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/8 "2025-04-02T05:32:32Z")

</div>

I never would have occurred to me those are tubes …

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [April 2, 2025, 5:32am UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/9 "2025-04-02T05:32:49Z")

</div>

> [@yesbird](#):
>
> May I use it in my [MathViewer](https://mathview.yesbird.online/) ?

Sure 🙂 Feel free to use and to modify it.

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [April 3, 2025, 2:02pm UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/10 "2025-04-03T14:02:23Z")

</div>

More funky stuff:

 ![изображение](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/2/e/2e6e91a6fb93c4cb7df73c85dbe61c949fdc9cde.png)

Demo: [https://codepen.io/prisoner849/full/MYWLEjx](https://codepen.io/prisoner849/full/MYWLEjx)

---

<div class="post-metadata">

**Author:** ![Lawrence3DPK](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/lawrence3dpk/32/29184_2.png) [@Lawrence3DPK](https://discourse.threejs.org/u/Lawrence3DPK)\
**Post date:** [April 3, 2025, 4:16pm UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/11 "2025-04-03T16:16:19Z")

</div>

+1 and these…

 ![Screenshot_20250403_171257](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/2/4/245202fa73e9abf2fa8215d9355b1039339f9251.jpeg)

Beautiful work! I’m keen to know how the geometry flows along the curves, do the edge loops follow the curvature of the “ripples” or are the vertices along the tube “displaced” into the resulting “ripple” form?

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [April 4, 2025, 7:19am UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/12 "2025-04-04T07:19:07Z")

</div>

> [@Lawrence3DPK](#):
>
> or are the vertices along the tube “displaced” into the resulting “ripple” form

Yes, look at it as a displacement. The vertex moves closer to or further from the curve, but doesn’t move around the curve.

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [April 9, 2025, 9:27pm UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/13 "2025-04-09T21:27:40Z")

</div>

More funky stuff #2:

Demo: [https://codepen.io/prisoner849/full/NPWVZML](https://codepen.io/prisoner849/full/NPWVZML)

---

<div class="post-metadata">

**Author:** ![Lukasz\_Mestales](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/lukasz_mestales/32/65638_2.png) [@Lukasz\_Mestales](https://discourse.threejs.org/u/Lukasz_Mestales)\
**Post date:** [April 10, 2025, 4:17am UTC](https://discourse.threejs.org/t/extended-tubegeometry/80539/14 "2025-04-10T04:17:40Z")

</div>

If my future wife deals with `3D`, I will find your codepen and give it to her…
