3

I'm laying out a network of blood vessels in Three.js. For this I've found THREE.TubeGeometry very useful. But I obviously can't form a branching network out of one tube. I need to join multiple tubes together. Here's an example:

(left) bad join, (right) smooth bend

On the left you see a point where multiple tubes join. In terms of Bézier curves, the three control points and the join-point are perfectly co-linear here. Still, it's obviously an ugly join. In contrast, look at the bend in the curve on the right side, created internally by TubeGeometry. I'd like my manual joins to be smooth like that.

It seems to be a bad alignment of cross-sections, which are not perfect circles, but 8-segment polygons. Indeed, if I increase the number of segments, the disparity becomes less noticeable, but this brings with it a big performance hit. And really, 8 segments is plenty. I think I just need to adjust their rotation to match, but I'm not sure how.

mhelvens
  • 4,225
  • 4
  • 31
  • 55
  • Related post with alternate approaches: http://stackoverflow.com/questions/20738386/how-to-create-a-three-js-3d-line-series-with-width-and-thickness. Also http://codeflow.org/entries/2012/aug/05/webgl-rendering-of-solid-trails/. – WestLangley May 20 '15 at 15:42
  • Thanks. But I don't think this addresses my issue. Both links reject Three.js `TubeGeometry` for one reason or another, and are trying to create it in some fundamentally new way. I'm basically fine with how `TubeGeometry` works, and my implementation is basically finished, except for this small detail. I don't think switching to a fundamentally different approach is the answer for me. :-) – mhelvens May 20 '15 at 16:12
  • Fair enough. I am not sure you will find a solution to your question, so I provided alternatives. The only other idea I could suggest is to extend your cylinders at each end a bit so they overlap at the junctions. – WestLangley May 20 '15 at 17:53
  • I get it. And that second link was still interesting. I think I will dive into the `TubeGeometry` code at some point to find the answer, possibly fork my own version of it. – mhelvens May 20 '15 at 18:30

0 Answers0