Skip to content
← Back to portfolio

How it’s built

This portfolio is an engineering project too. Here’s the live scene, with controls to play with it, and the technical decisions behind it.

FPS
–
ms/frame
–
Beads
–
Draw calls
–
Triangles
–
Points
–

Use the control panel to switch shapes, change the number of beads or turn on debug mode. With “dense” and “points” you can compare up to 50,000 beads drawn as particles.

One mesh, thousands of beads

Every bead is an instance of a single low-poly sphere drawn with InstancedMesh: one draw call for thousands of objects.

The material is a high-roughness MeshPhysicalMaterial with sheen, extended with onBeforeCompile, so the morphing is injected into the vertex shader without rewriting three.js lighting.

Pre-baked shapes

Shapes are generated once in Node with MeshSurfaceSampler: 19 shapes of 6,000 points, quantised to Int16 (798 KB).

Point order is random, so any prefix is a uniform subsample: mobile uses fewer beads without changing anything else.

In the browser the shapes are uploaded to the GPU as a data texture, and the shader reads them with texelFetch using each instance’s index.

Scroll as a timeline

Each content block declares its shape with a data-shape attribute. A scene director, a pure, tested function, turns scroll into “source shape, target shape and progress”.

Each bead has its own delay (partly random, partly based on its height) and a spring curve, which is why shapes build up from the bottom with a bounce.

Performance and accessibility

PerformanceMonitor automatically lowers quality (beads, resolution and ambient occlusion) when the device can’t keep up.

All content is real HTML. The canvas is decorative, respects prefers-reduced-motion and can be paused. Without WebGL the site still works.

Architecture

  1. 01

    Frontend · Vercel

    • React 19 + TypeScript
    • React Router (/es, /en)
    • Zustand
    • Lenis
    • Tailwind CSS 4
  2. 02

    Scene · WebGL2

    • React Three Fiber
    • InstancedMesh + onBeforeCompile
    • Shapes in a DataTexture
    • N8AO + grain
  3. 03

    Build and quality

    • shape-baker (Node + three)
    • Vite
    • Vitest
    • GitHub Actions

Architecture decision records (ADR)