·3 min read
Building this portfolio: a 3D scroll site that stays fast
One WebGL canvas, a scroll-driven camera, performance tiers and a fallback for every device. Here is how this site is put together.
Three.js / React / Performance / Astro

This site is a single long page where a 3D scene follows you as you scroll: the logo floats in at the start, the camera passes project screens, and everything ends at a glowing portal by the contact form. It looks heavy. It isn’t, and that took more planning than the visuals did.
Here are the decisions that mattered.
One canvas, many sections
The easy approach is a separate 3D canvas inside each section. Every canvas creates its own WebGL context, browsers cap how many you can have, and each one renders independently. Instead there’s one fixed canvas behind the whole page.
Each HTML section reports how far it has scrolled, and that becomes a single number I call the journey: section index plus progress, so 3.5 means halfway through the fourth section. The camera, the logo and every 3D “station” read from that number. Stations that are far from the current journey value aren’t drawn at all.
// a section at index i, scrolled 40% through
journey = i + 0.4;
// each station decides whether it is near enough to render
const visible = Math.abs(journey - station.index) < 1.5;
That one number makes the scene easy to reason about. Moving a keyframe means changing a value in a table, not untangling scroll listeners.
Text stays in HTML
All copy is real HTML on top of the canvas: it’s readable by search engines and screen readers, it can be selected, and it’s styled with the same CSS as everything else. The 3D layer is decoration and atmosphere, never the only place information lives.
Performance tiers, decided before first paint
A small inline script in the <head> checks for WebGL, screen size, device memory and the reduced-motion setting, then tags the page as high, mid or low before anything renders. The scene reads that tag:
- High gets post-processing (bloom, grain, vignette), more particles and an animated light sweep.
- Mid keeps the scene but drops post-processing and lowers the pixel ratio.
- Low or no WebGL gets a static, fully designed layout with no canvas at all.
Because the tag is set before paint, the layout never jumps when JavaScript loads.
Things that went wrong
backdrop-filterover WebGL. Frosted-glass panels on top of the canvas blanked the 3D scene in some browsers and were expensive everywhere. They became solid, slightly translucent panels instead.- Lighting on weaker GPUs. The chrome logo relies on reflections. On the cheaper tiers the reflection map stopped updating and the logo turned almost black. The fix was a soft frontal light source baked into the environment so there’s always something to reflect.
- Overly clever pinning. I started with JavaScript pinning for sticky sections, then replaced it with plain CSS
position: sticky. Less code, smoother on mobile.
The stack
Astro renders the page as static HTML, with one React island for the interactive parts. Three.js through React Three Fiber handles the scene, GSAP ScrollTrigger measures scroll progress, and Lenis smooths the scrolling. The journal you’re reading is plain Markdown in the same project.
The lesson I keep relearning: the 3D is the easy part. The work is making sure the site still makes sense when the 3D isn’t there.