3D

Black Hole

A real-time Schwarzschild black hole in the browser, with light rays traced per pixel in WebGL2.

View live (opens in a new tab)View code (opens in a new tab)

Open live site

Role
Solo designer and developer
Timeframe
Oct 2026

Problem

Images of black holes are usually pre-rendered or faked with a texture. The aim was a Schwarzschild black hole that runs live in a browser tab, where the shadow, photon ring and warped accretion disk come from tracing light rather than from artwork, and that stays usable on slower devices.

Approach and decisions

The project is TypeScript and Vite with WebGL2 and GLSL. Every pixel traces a ray backwards through curved spacetime in a fragment shader. The code is split into src/physics (Schwarzschild geometry, disk, colour), src/render (renderer, quality control and six shaders, including bloom) and src/sky/stars.ts. The sky uses a 145,536 B binary star catalogue over a 498,197 B Milky Way image. The Physical look applies Doppler and redshift; the Film look switches them off. Quality has four tiers and steps down automatically when frames run slow.

GitHub Pages cannot set response headers, so the Content-Security-Policy is a meta tag (decision 11).

What broke and how it was fixed

  • The house .gitignore ignored public/data/, which would have deployed a site with no stars (decision 15).
  • Cubemap texels near face corners covered up to 5.2 times less sky, so stars there looked dim; the flux was corrected (decision 17).
  • The canvas trapped page scrolling; cooperative gestures fixed it (decision 20).

Results

The site is live on GitHub Pages and the repository is public. It was built in 6 commits between 2026-10-17 and 2026-10-19, with four unit-test files and one end-to-end test that includes an axe accessibility check. The page fetches only its own files and needs no keys.

Whatโ€™s next and limits

This models a non-rotating black hole only; spinning (Kerr) geometry is not implemented. Performance depends on the GPU, which is why the quality tiers exist. The star catalogue is limited to bright stars.

Screenshots

  • The black hole with a dark shadow and a thin bright photon ring, framed by a warped, brightened accretion disk over a starfield, with the controls panel open on the right.
    Physical look
  • The same black hole with Doppler beaming and gravitational redshift switched off, so the accretion disk is an even warm gold.
    Film look
  • The black hole on a phone-sized screen, with the title and frame-rate readout at the top and a Controls button at the bottom right.
    Mobile
HomeProfessional
ProjectsProfessional
All ProjectsProfessional
SoftwareProjects
InteractiveProjects
Data and AnalyticsProjects
OtherProjects
ExperienceProfessional
Quick summaryProfessional
Career TimelineProfessional
UsesProfessional
QualificationProfessional
Project HubProfessional
Code SnippetsProfessional
InteractiveProfessional
ResumeProfessional
Privacy
Terms
Cookies
QuestArchiveSoftware
DueReminderSoftware
AccessEaseSoftware
TL;DR PanelSoftware
asset-vaultSoftware
gfx-kitSoftware
House KitSoftware
sg-data-hubSoftware
vin-contextSoftware
vin-workflowSoftware
Black HoleInteractive
3D RoomInteractive
QR GardenInteractive
Synthwave DriveInteractive
MRT WindowInteractive
DevPulseData and Analytics
MetaLens VGCData and Analytics
esp32-core-kitOther
Toggle light / dark
Switch sidePersonal
Pause / resume effects
Copy email
Random page
Keyboard shortcuts
Download resume (PDF)

โ†‘โ†“ move ยท Enter open ยท Esc close

Keyboard shortcuts

Ctrl K / โŒ˜K
Search the Site
?
Keyboard shortcuts
Esc
Close

ACHIEVEMENT UNLOCKED