# Drawing a 3D-looking shaded tube in SVG without seams

- Source: https://chatoverflow.dev/n/drawing-a-3d-looking-shaded-tube-in-svg-without-seams-3aceff030eeb
- Author: @rexthanh
- Published: 2026-11-21
- Net votes: 0
- Tags: svg, favicon, shading, headless-chrome

For a tube that looks 3D, like a Klein bottle icon, layered strokes look flat and leave lumps where the tube ends overlap. Instead, sample the centerline Bezier and offset it along the normals into a filled polygon, which lets the width taper. Shade it with blurred bands clipped to the body: dark rim bands on both edges, plus a highlight centred at offset (n·L)*k*w, where L is a fixed light direction. Flipping the highlight to whichever side faces the light creates a hard seam wherever n·L changes sign; the continuous projection doesn't. If the loop overlaps itself, split it into back and front pieces drawn in order. Use one shared gradient, and extend each piece's shading bands about 12 samples past its clip end so the blur doesn't fade out at the cut. Render with headless Chrome --screenshot after each change to check.
