← All projects

Creative coding

NEBULA LAB · Three.js web motion lab

24 pure front-end experiments in 3D, physics and shaders — black-hole ray tracing, GPU fluids, tearable cloth, a drivable neon sports car… all playable right in the browser.

🌌

Overview

  • 24 interactive pieces in 4 groups — shaders, particles, 3D scenes and physics — reached from a 3D carousel lobby
  • Covers ray marching, GPU fluid simulation, reaction–diffusion, Verlet cloth, rigid-body physics and swarm behaviour
  • Render resolution adapts to the measured frame rate, with a 140 BPM soundtrack synthesised live in Web Audio
three.jsWebGLGLSLBabylon.jsMatter.jsWeb Audio
Type
Creative coding
My role
Concept · design · development
Date
2026.10
Status
Done
Star
0
Fork
0
Commits
8
  • HTML 90%
  • JavaScript 10%
  • Python 0.2%
git clone https://github.com/42ccode/ClaudeThreejsTest.git

Last push 2026-10-23 · fetched from GitHub when the site was built

What it is

A set of web motion experiments, all pure front end: no build step, libraries loaded from a CDN, and it runs from a local server once downloaded. The way in is the “lobby”, a 3D carousel of shader cards. It’s mostly Three.js: 18 of the 24 pieces use it, and the rest use Matter.js, Babylon.js, OGL or Canvas 2D.

The pieces

24 pieces in 4 groups of 6. The lobby lets you move between them, and the menu in the bottom-right corner lists them all by group.

Shaders

Piece What you do Technique
Liquid metal Watch blobs merge and split Ray marching + smooth SDF blending
Event horizon Circle a black hole and watch light bend OGL · general-relativity ray tracing
Fluid ink Stir coloured ink with the mouse Navier–Stokes solved on the GPU
Reaction–diffusion Watch patterns grow on their own Gray–Scott reaction–diffusion
Aurora Light curtains over an arctic lake, reflected Layered sampling of light curtains + reflection
Sunset ocean Waves rolling under a setting sun Ray-marched sea surface

Particles

Piece What you do Technique
Particle universe 20,000 particles change shape as you scroll Shape morphing + scroll storytelling
Hyperspace jump Hold the mouse to dive into a star tunnel Instanced rendering + chromatic aberration and radial blur
Particle text Type a sentence and particles spell it out Text sampling + spring physics
Fish school A school of fish dodges a predator Boids + spatial-grid neighbour search
Fireworks Click anywhere for a burst Particle system + motion trails
Galaxy collision Two galaxies brush past each other 26,000 stars under two gravity cores

3D scenes

Piece What you do Technique
Neon highway Drive a sports car through neon mountains Procedural terrain + a drivable car
Car teardown Take the car apart or X-ray it Exploded view, flat-lay view, scan effect
Sound planet A planet’s surface moves with the music FFT spectrum driving the terrain
Neon cube Turn the layers and race the clock A 3×3 puzzle cube with turnable layers
Tiny planet Plant trees and build houses on a small planet Low-poly modelling + placement on a sphere
Cyber city Fly through neon traffic on a rainy night Instanced buildings + hover-car traffic

Physics

Piece What you do Technique
Physics lab Knock over a neon block tower Babylon.js 7 + Havok rigid bodies
Zero-gravity page Make the whole page fall down Matter.js turns DOM elements into rigid bodies
Tearable cloth Pull and cut a neon net Verlet point masses and springs
Falling sand Sprinkle pixel elements and watch them react Canvas 2D cellular automaton
Galton board Balls drop into a bell curve Matter.js pegboard
Jelly A jelly that keeps an eye on you Shape-matching soft-body physics

Tech stack

Library / API Used for
three.js Most 3D pages, plus post-processing
OGL Event horizon (a lighter WebGL wrapper, good for one full-screen shader)
Babylon.js 7 + Havok Physics lab
Matter.js Zero-gravity page, Galton board
Canvas 2D Falling sand, jelly
Web Audio Soundtrack synthesis, the sound planet’s spectrum

Running it locally

The pages use ES modules and CDN dependencies, so opening the HTML file directly is blocked by the browser. Start a local server:

git clone https://github.com/42ccode/ClaudeThreejsTest.git
cd ClaudeThreejsTest
python3 serve.py

Then open http://localhost:5173/hub.html for the lobby. serve.py works like python3 -m http.server but turns off browser caching, so a refresh shows your changes straight away.

How it was made

  • Smoothness: every 3D page measures its frame rate and lowers the render resolution when frames drop, so it stays smooth on laptops too.
  • Sound: the soundtrack isn’t an audio file — bgm.js synthesises a 140 BPM trap beat live with Web Audio. It starts muted; press M to toggle it.
  • Shared modules: the menu, circular page transitions, custom cursor and the procedurally built sports car are shared scripts used by several pages.

The whole project was built together with AI (Claude Code): I came up with the ideas, set the look and polished the details, and the AI wrote the code.