How it works
Sixteen tapered chrome tubes chase the cursor like a bundle of cables. Each tube is a chain of points in which every point lags the one ahead of it, so a tube’s shape is literally the pointer’s recent path, crisp at the head and progressively smoothed toward the tail. There are no tube meshes: one instanced draw per pass (the scene, plus the cast shadow on the light presets) extrudes camera-facing ribbons from a spline in the vertex shader, and the fragment shader rebuilds the round cross-section analytically and lights it like polished metal.
Pipeline (per frame)
CPU (~0.13 ms of JS, 0.2 ms p95)
pointer │ intro ghost │ idle figure-eight ──▶ one blended target
chains 16 tubes × 64 points: dp/dt = k·(lead − p), swept head → tail
in substeps of ≤ 1/240 s (4 per frame at 60 Hz), target lerped across the frame
pack sort tubes far → near ▸ drop points < 0.6 px apart ▸ arc length, radius
▸ spline curvature per point ─▶ corners (2 passes; none under 2–3.5 px of radius
or in the last 10–16% of the tail) ▸ runs of corners within 0.9 radii merge
▸ sample measure, 6 per chain point (at most 1024 per tube):
arc (1 per 5 px) + bends (angle × √radius) + round joins (integer runs)
▸ per segment: the fold it leads into, if within 2.5 radii (for the mitre)
──▶ texSubImage2D uPts RGBA32F (64 + 1) × (2 × 16) texels = 33 KB
GPU
[shadow] light presets only
same instanced strips, widened by the blur width, offset by height,
MAX blend ─────────────────────────────▶ shade RGBA8 640 × 360 (¼)
[tubes] drawArraysInstanced(TRIANGLE_STRIP, 2 × 384 vertices, 16 instances), no attributes
VS: binary-search the measure ▸ centripetal Catmull-Rom ▸ ribbon ⟂ tangent and view
(or, inside a join, a fan sweeping the outer side around the corner point)
radius sin(πt)^taper ▸ inner side squeezed to the bend radius ▸ +1 px AA skirt
FS: offset q across the ribbon ▸ mitre cut on a fold's head-side arm
▸ normal q + √(1−|q|²)·view (cylinder or cap sphere) ▸ GGX × 4 point lights
▸ strip-light studio env (split-sum fit) ▸ emissive core ▸ depth fade
premultiplied “over”, painter’s order ─▶ scene RGBA16F 2560 × 1440
[bloom] dark presets only (skipped when strength = 0)
prefilter: 5-tap dual filter, Karis weights, soft knee ─▶ L0 RGBA16F 1280 × 720
down × 5 (dual filter) ─▶ 640 × 360 … 40 × 22
up × 5 (tent, blend radius·src + dst) ─▶ L0
[composite] ─▶ canvas 2560 × 1440
backdrop + glow + vignette ▸ × shadow ▸ ACES(unpremultiplied tube × exposure)
▸ screen(ACES(bloom)) ▸ TPDF dither
The ideas that matter
- A chain of lags is a smoothing filter. Point i sees the head’s path convolved with an Erlang kernel: its mean delay is i/k and its spread is √i/k. So the head follows the cursor tightly, while the tail draws a lazy, smoothed echo of it, with no explicit smoothing code. Each tube gets its own stiffness (×0.62 to ×1.38), which gives tails of different lengths that weave past each other.
- Refresh-rate independence, exactly. The observed reference lerps every point halfway each frame, which makes the tail half as long in time at 120 Hz (1.55 → 1.11 half-heights of tail on a 3 s test path). Here each frame is split into substeps of ≤ 1/240 s. A head-to-tail sweep with gain α delays each link by h(1−α)/α, so the page uses α = kh/(1+kh), which makes that delay exactly 1/k for any h. Measured on the same path, 30, 60, 120, 144 and 165 Hz agree to within 0.14%. The target is interpolated across the substeps, so a fast flick still bends smoothly.
- Taper by arc length, not by index. When the pointer stops, the head’s points bunch together. An index-based
sin(πt)taper would then put full radius on a few pixels, giving blunt, folded caps. The CPU stores normalised arc length per point (after dropping points closer than 0.6 px, whose tiny chords only carry noisy directions), so the tube always narrows to a needle. A tube shorter than about ten radii also slims down instead of turning into a blob. - Folds are round, like a real tube’s. A left-right swipe reverses the chain on itself. A camera-facing ribbon cannot follow that: its side vector flips where the tangent reverses, the strip twists into a bow-tie, and the fold looks like a pipe cut flat. So the CPU finds corners: points where the spline bends tighter than the tube is thick, or turns by more than about 110°. It measures the bend with the spline’s own curvature, because an isolated turn of a Catmull-Rom curve hooks four to eight times tighter than the circle through its three points. A second pass promotes a corner’s neighbour when the corner’s broken tangent makes the next short segment hook. At a corner the vertex shader breaks the tangent cleanly and inserts a round join: the outer vertex sweeps an arc of one radius around the corner while the inner vertex sits on the axis, so the strip becomes a fan that draws a half-disc cap. The cap is shaded as a sphere, and it meets both arms with matching normals. The corner weight is continuous, so corners fade in and out without popping. Corners only form where the tube still has body. Under about 3 px of radius, or in the last 12% of the tail, a fold stays a smooth U-hook, because a round join on a needle tip reads as a forked, two-prong claw. A tight fold often lands on a run of two to four chain points that sit closer together than the tube is thick. Drawn as separate joins with sliver segments between them, it showed seams and a ragged notch inside the fold, so a run within 0.9 radii merges into one corner at its centroid. The cast shadow uses the same geometry, so it gets round ends too.
- Mitred folds. In painter’s order a fold’s head-side arm is drawn over its tail-side arm, and the head-side arm’s flat end used to lie across the other arm as a visible notch. Each segment that ends within 2.5 radii of a fold carries that fold’s first and last corner. The vertex shader passes four affine coordinates (the signed distance from each arm’s axis line, and the position along each arm), so they interpolate exactly. The fragment shader then fades the head-side arm softly wherever a point lies nearer the tail-side arm’s axis than its own. It does this only within about 1.5 radii of the fold and only past the start of the tail-side arm, so that arm really is underneath. The result is a mitred elbow. A hairpin’s arms coincide, so the distances tie and nothing is cut.
- Samples go where the curve turns. Every tube gets the same number of strip samples (6 per chain point, capped at 1024 per tube, so about 5.3 at the 192-point maximum), but they are spent by a measure, not spread evenly: one per ~5 px of arc, plus extra for bends (turn angle × √radius, enough to keep the outer edge round at any thickness), plus an integer run for each round join, aligned to whole samples so a join starts and ends exactly on its arms. The vertex shader binary-searches the measure. A 30 px loop that used to get 6–8 straight facets now gets dozens.
- Centripetal Catmull-Rom. Knot spacing is the square root of each chord, written as Hermite tangents in the shader. Unlike the uniform spline, it cannot form cusps or overshoot loops inside a segment where point spacing changes abruptly at a decelerating head (Yuksel et al.).
- The cylinder is analytic. The ribbon carries the offset from the axis, q, in radii (a vector across the ribbon, exactly linear across every triangle, including the join fans). The normal is
q + √(1−|q|²)·view, and the surface point and its lighting follow from it. Edge coverage is computed in pixels from the same coordinate, and sub-pixel tips fade (radius never drops below 0.7 px; alpha scales instead), so there is no MSAA and no shimmer. - Specular anti-aliasing without derivatives. Thin tubes cannot show a 1 px glint without sparkling, so the GGX lobe is widened by the normal’s change per pixel. Across a cylinder that change is analytic, dθ/dpx = 1/(rpx·h). An earlier
dFdx(n)version jumped at every strip triangle and left a dotted line along each silhouette. - Tight bends squeeze instead of folding. Where a smooth bend is still tighter than the tube (corners take the really tight ones), the inner edge of a camera-facing ribbon would cross itself and draw chevrons. The vertex shader takes the curvature vector from the spline’s first and second derivatives and clamps the inner extrusion to the bend radius. It leaves the across-coordinate unclamped, so the inner side squeezes and keeps its anti-aliased edge instead of being cut off. It never clamps the vertex that sits on a corner, which has to meet its join exactly.
- No depth buffer, on purpose. Depth-tested cylinders intersect physically, but their intersection edges are binary (aliased), and anti-aliased fringes block the tubes drawn behind them, leaving halos. Tubes are instead sorted far to near every frame and each strip is drawn tail to head, so the newest segment lands on top and every edge stays soft.
- Strip lights make chrome. Four corner point lights only catch tube sections that run perpendicular to their half-vector. That is why the benchmark’s glints slide along the tubes, and also why horizontal sections go dead. A procedural studio of narrow HDR strip lights (above, left key, right fill) over a dark wall and floor gives every orientation a crisp streak, and roughness widens it, standing in for a prefiltered map. The diffuse lookup sees those strips at 12% strength, because narrow strips subtend little solid angle; at full strength they lit plastic bodies as brightly as the highlight and killed the gloss.
- Distinct colours stay saturated, and every colour gets thick tubes. Each tube sits near one of the three ramp stops (with a little jitter); interpolating magenta toward cyan in linear RGB gives lavender, which turned the Neon preset pastel. Thicknesses are stratified (an even spread, more thin than thick) and dealt round-robin over the three colours in a shuffled order. With independent random draws, all the cyan tubes in the Neon bundle came out hairline-thin. The emissive gas is dark at the glass edges and saturated toward the axis, with a narrow white-hot core whose width never drops below about a pixel. Its colour is balanced by luminance, so lime doesn’t outshine magenta three to one.
- Glow that never clips. Bloom is a dual-filter pyramid (Bjørge) with Karis weights on the first downsample, so one hot glint cannot flicker the chain. It is tonemapped separately and screen-blended over the tonemapped image. Light presets set strength to 0 and skip the passes entirely.
- Never a dead frame, never in the way. When the pointer rests (0.9 s) or leaves, the target eases into a 1:2 Lissajous figure-eight. It is taller than the intro’s path, and the chains soften by a quarter as it takes over, so the resting bundle still sweeps the open part of the hero with tails a third longer. Its speed never drops below 0.1 rad/s, so it never freezes into a knot. On wide screens it is placed to the right of the headline: once per resize the page measures the copy’s text (a DOM Range, not the block) and starts the path a margin past it. On portrait screens it sits above the headline. The intro ghost stays in the same region and hands straight over to it. The gallery thumbnail instead loops a large centred figure-eight with longer tails and thicker tubes, so any captured frame shows the bundle sweeping through its own crossing. The page is ambient: it keeps drifting while visible and pauses when off-screen or when the tab is hidden. The canvas sits under the copy, so the tubes can never cover a click target.
Parameters
Presets
Performance & compatibility
- Measured (harness, 1280 × 720 @2x = 2560 × 1440 backing store, Apple M-series, Chrome): 60 fps throughout the scripted sweep (frame-time p95 16.7 ms, no frame over 25 ms). The canonical figure comes from a serial full harness run, started after 20 s with no other build’s harness running and with none running during it. Other sessions still kept the CPU at a load average near 3, so this is the quietest machine available, not a fully idle one. That run measured 3.75 ms of GPU per frame on average and 7.4 ms at p95, with 0.13 ms of JS per frame (0.2 ms p95). Its window includes the first second after load. A separate 2 s sweep straight after it (best of three) gave the default preset a median of 1.9 ms, a mean of 2.4 ms and a p95 of 5.1 ms. Under contention from other builds, earlier full runs read 3.2–8.0 ms mean and 5.3–11.5 ms p95. The corner, merge and sample-measure work in
pack()is most of the JS. The full-resolution RGBA16F clear and composite are a fixed cost; the rest is tube fill, and the bloom pyramid adds about 0.2 ms. - Per preset (best median of three 2 s sweeps in the same quiet window, with the p95 of that sweep): ServiceTitan Max 1.9 ms (5.1) · Neon 2.0 ms (4.4) · Liquid chrome 1.6 ms (4.2), which adds the ¼-resolution shadow pass but has no bloom · Candy 2.5 ms (6.4), with thick tubes plus the shadow · the 48-tube × 192-segment maximum 4.9 ms (5.7), with 0.7 ms of JS.
- What scales it: full-resolution fill of the tube pixels (with 16 overlapping tubes the core of the bundle has a few layers of overdraw) plus the RGBA16F scene clear and the composite read. Geometry is negligible: 16 × 768 vertices, each a ~10-step binary search and a Hermite evaluation. An interleaved A/B of 3 vs 6 strip samples per chain point showed no measurable GPU difference (p25 2.5–3.9 vs 2.2–3.1 ms). The bloom chain starts at half resolution.
- Mobile: On coarse pointers the HDR scene is capped near 2 MPx (the composite upsamples it), the bloom pyramid stops at 4 levels, and the idle figure-eight renders at 30 fps; any touch restores the full rate on the next frame. In the harness’s 390 × 844 touch emulation (DPR 3, canvas capped at 2×, so 780 × 1688 = 1.3 MPx, under the cap) touch-drag ran at about 48 fps. That emulation runs on the shared desktop GPU, so it is not a phone measurement. There was no horizontal overflow, and the controls sheet fits (8–382 px). On portrait screens thickness and spread shrink by √aspect, and the idle drift moves above the headline. Touch-drag steers the head, and lifting the finger hands back to the idle drift. The library shell sets
touch-action: noneon the stage, so on a phone a swipe on the full-height hero steers the tubes rather than scrolling; the “How it works” button jumps past it. - Reduced motion: the intro runs for 1.8 s on the CPU only, then a single frame is rendered; nothing animates until “Play anyway”.
- Requirements: WebGL2 with
EXT_color_buffer_float(RGBA16F targets). Without them the page shows its poster and a message. No textures, fonts or network requests: everything is procedural.
References & credits
- Observed reference: TubesCursor from
threejs-componentsby Kevin Levron, the renderer behind the servicetitan.com/max hero. It is described inresearch/site-survey.mdandresearch/eulerian-fluids.md: CPU follow-the-leader chains,sin(πt)taper, metal tubes, four coloured point lights, threshold-0 bloom, and a Lissajous idle. https://www.npmjs.com/package/threejs-components (ISC). This page is a from-scratch re-implementation in plain WebGL2 and contains none of its code; the instanced-ribbon and analytic-cylinder approach follows the notes inresearch/gpgpu-particles.md(filament ribbons). - Benchmark: ServiceTitan Max hero, https://www.servicetitan.com/max. The default preset reuses its published palette (#0070d4, #6cb4ee, #4da3e8, #89c9f7) to match the look; this page is not affiliated with ServiceTitan.
- B. Karis, “Real Shading in Unreal Engine 4” (SIGGRAPH 2013 course notes), https://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf: GGX, Schlick Fresnel (formulas). E. Heitz, “Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs”, JCGT 2014, https://jcgt.org/published/0003/02/03/: height-correlated Smith visibility.
- B. Karis, “Physically Based Shading on Mobile” (2014), https://www.unrealengine.com/en-US/blog/physically-based-shading-on-mobile: the analytic environment-BRDF fit (formula).
- A. Kaplanyan, S. Hill, A. Patney, A. Lefohn, “Filtering Distributions of Normals for Shading Antialiasing” (HPG 2016), https://research.nvidia.com/publication/2016-06_filtering-distributions-normals-shading-antialiasing, and Y. Tokuyoshi & A. Kaplanyan, “Improved Geometric Specular Antialiasing” (I3D 2019), http://kaplanyan.com/#publications (open follow-up: https://www.jcgt.org/published/0010/02/02/): the normal-variance lobe widening, here with an analytic variance (formulas).
- M. Bjørge, “Bandwidth-Efficient Rendering” (SIGGRAPH 2015), https://community.arm.com/cfs-file/__key/communityserver-blogs-components-weblogfiles/00-00-00-20-66/siggraph2015_2D00_mmg_2D00_marius_2D00_notes.pdf: dual-filter blur. J. Jimenez, “Next Generation Post Processing in Call of Duty: Advanced Warfare” (SIGGRAPH 2014), https://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare/: Karis-average firefly suppression. See
research/distortion-glass-post.md. - K. Narkowicz, “ACES Filmic Tone Mapping Curve” (2016), https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ (formula).
- Dave Hoskins, “Hash without Sine”, https://www.shadertoy.com/view/4djSRW (MIT):
hash12, used for the dither noise. - E. Catmull & R. Rom, “A Class of Local Interpolating Splines”, in Computer Aided Geometric Design (Academic Press, 1974), https://doi.org/10.1016/B978-0-12-079050-0.50020-5: the spline through each chain. C. Yuksel, S. Schaefer, J. Keyser, “Parameterization and Applications of Catmull-Rom Curves” (Computer-Aided Design, 2011), https://cemyuksel.com/research/catmullrom_param/: why the centripetal parameterization has no cusps or self-intersections within a segment (formulas).