Varun Godham. Open the 3D room

How I built a 3D portfolio room in React Three Fiber

My portfolio is a 3D studio room that runs in the browser, built with React Three Fiber on top of three.js. Every object in it tells part of my story: the TV plays my case studies, the walls hold my certificates and ID cards, the guitar plays when you click it, and the window shows my hometown, Dwarka, with the real sun and moon for your time of day. It loads about 9.3 MB, compiles all 52 of its shader programs in parallel before the first frame, and draws nothing while a view sits still. The same story also ships as plain HTML, so search engines, AI assistants and anyone who would rather not use 3D can read it.

At a glance

  • Stack: React 19.3, three.js r186, React Three Fiber 9.8, drei 10.7, postprocessing 6.39, Vite 8.3 and TypeScript 6.0 in strict mode.
  • Weight: about 9.3 MB in 116 requests until the room is ready, measured on a local production build on 8 November 2026. The music loads only after your first click or key press.
  • Time to ready: 6.5 to 7.4 s in three headless Chrome runs on my Windows PC with integrated AMD Radeon graphics (8 November 2026). Headless Chrome is slower and noisier than a normal browser, so treat it as a number for before-and-after comparisons.
  • Idle cost: 0 frames drawn while a still view sits idle (counted on the desk and experience views).
  • Start-up: 52 shader programs compiled in parallel before the first frame.
  • Access: keyboard controls, reduced-motion support and a full text version of the room, also at /about/.

What's in the room, and why a room?

The room is 5.6 by 4.8 metres with a 2.75 metre ceiling, split into seven zones: the desk, my avatar, the window, the TV wall, the lounge, the left wall and the floor. Each zone loads on its own and sits in its own error boundary, so a bug in one corner removes only that corner, never the whole room.

  • The TV wall plays my 9 case studies as slides, each with a drawn mockup of the product.
  • The desk holds a pegboard with the 24 tools I use, an open book with my 6-stage design process, live monitors and an iPad that plays music.
  • I'm at the desk too: my head comes from a Meshy AI scan of me, on a MakeHuman body posed in Blender.
  • My certificates, ID cards and the Innovator Award trophy are on the walls and the desk shelves.
  • The lounge has a guitar you can strum, and the envelope by the door opens a contact form.
  • The window looks out on Dwarka, live for your time of day.

Why a room? A designer's studio says a lot about the person who works in it, so I put each part of my story on an object you would expect to find there, and you explore it instead of scrolling past it. It also shows the second half of my job title, frontend developer, by doing it rather than listing it.

Which tools did I use?

PartTools
3D renderingthree.js r186, React Three Fiber 9.8, drei 10.7 (camera-controls for the camera)
Post-processingpostprocessing 6.39 with N8AO ambient occlusion, bloom and SMAA
InterfaceReact 19.3, plain CSS, lucide icons
BuildVite 8.3, TypeScript 6.0 (strict), ESLint, and a small Vite plugin that writes the SEO output
ModelsPoly Haven CC0 models and textures, the MakeHuman base mesh (CC0), Blender 4.2 scripted in Python, meshopt compression and WebP textures
My avatara Meshy AI scan of my head, joined to a MakeHuman body in Blender
2D artcanvas painters in TypeScript; the Dwarka town painted in code with Python (NumPy and Pillow)
Soundthe Web Audio API, no library; the guitar is synthesised, the music is a playlist of files
Testingheadless Chrome driven over the DevTools protocol, and Node self-checks for the maths
CodeClaude Code (AI coding agents)

I designed and directed the room, and built it with AI coding agents (Claude Code).

How did I plan it like a UX project?

I treated the room like any product I design: content first, then structure, then the interface. Every word about me lives in plain TypeScript data files in src/content/, mainly profile.ts and projects.ts. Each project figure carries a source and an "as of" date, because a portfolio is a public CV and one wrong figure costs trust. One content source then feeds every output:

  • the room: hover labels, the info cards and the TV slideshow
  • a full text version of the room inside the home page, for screen readers and crawlers
  • /about/, the same story as an ordinary web page
  • JSON-LD for search engines: me as a Person, the home page as a ProfilePage, my projects as CreativeWork
  • llms.txt and llms-full.txt for AI assistants
  • these making-of pages, whose code samples are read from the real source files at build time

A small Vite plugin writes all of the text outputs at build time, and the cards that go into search are picked one by one, so a new object in the room never lands in search by accident.

How does the window show the real sun and moon over Dwarka?

Dwarka is my hometown, on Gujarat's western tip where the Gomti river meets the Arabian Sea. The window looks south over it. Under 100 lines of dependency-free TypeScript work out where the sun and moon are for your clock (read as Indian time), the moon's phase for today and which side of it is lit. The sky, stars, sun, moon and sea are painted live on a canvas once a minute, and the town and the Dwarkadhish temple crossfade between four pre-lit painted layers (dawn, day, dusk and night) by the sun's height.

The code, how the window uses it and how far off it is against real eclipses: Sun and moon position in JavaScript, without a library.

How does the guitar play without samples?

Click the guitar in the lounge and it strums G, Em, C and D in turn. There are no audio files: each string is a Karplus-Strong pluck, a burst of noise fed back through a delay line one period long, computed into an AudioBuffer the first time that note is needed. The guitar rocks on its foot for a second after each strum, and asks for frames only during that second.

The whole synth, its pitch and decay numbers and its test: A Karplus-Strong guitar in Web Audio, with no samples.

How does it stay fast and easy on battery?

The first version took about 50 seconds to open on Windows. Chrome and Edge on Windows run WebGL through ANGLE on Direct3D 11, compiling shaders there is slow, and the RectAreaLights I had added made every material's shader heavier. I removed them, compiled all 52 programs in parallel with compileAsync before the first frame and merged material variants: the first open dropped to about 7 s, and a later load pass took a headless run from 7.7 to 6.1 s.

The canvas renders on demand (frameloop="demand"), so a still view draws 0 frames. Every animation asks for frames only while it is big enough on screen, the tab is visible and reduced motion is off.

The details, with the code and how I count idle frames: Fixing a 50-second three.js shader compile on Windows.

How do search engines and AI assistants read a canvas site?

Mostly, they don't see the canvas at all. A WebGL canvas is pixels, and published crawler tests show that the crawlers behind ChatGPT, Claude and Perplexity fetch the HTML without running JavaScript. Google does run JavaScript, but it can't read words painted into a canvas either. So nothing important lives only in the room:

  • The home page's HTML carries a full text version of the room: its cards, projects and numbers. It is visually hidden while the room is open, but it is the same HTML for everyone: the first Tab stop, "Skip to the text version", opens it, screen readers read it, and without JavaScript it simply is the page.
  • JSON-LD describes me, the home page and my projects, using only facts that are visible on the page.
  • /about/ has the whole story as a plain page, and each making-of page is static HTML that does not need JavaScript.
  • robots.txt welcomes every crawler, AI crawlers included: I want to be found.
  • llms.txt lists the pages for AI assistants, and llms-full.txt holds the full text.
  • Each page's "Updated" date is the day its content last changed in git, not the day I last deployed.

Can people use it without a mouse, or without 3D?

  • Keyboard: W A S D or the arrow keys walk, Q and E move down and up, 1 to 7 fly to the seven sections, R or Home returns to the overview, and M turns the music on or off.
  • The first Tab stop is "Skip to the text version". It opens the full text over the room, and the arrow keys then scroll the text instead of moving the camera behind it.
  • "Read as text" in the corner opens /about/, the same story as an ordinary page.
  • With reduced motion switched on in your system settings, camera moves jump instead of flying, and the steam, the temple flag, the PC lights and the TV slideshow stay still.
  • Without JavaScript, the text version is the page.

How does analytics respect consent?

I use Google Analytics 4 to see which parts of the room people explore. It runs in Consent Mode: ad storage is always off (there are no ads), and in the EEA, the UK and Switzerland, or anywhere with a European timezone, nothing loads until you say yes in a banner where Decline and Accept look the same. Anyone can switch it off in Settings, and a no deletes the analytics cookies. Only the names of things are sent (views, cards, projects, songs, which profile link), never anything you type. The tag loads only on varungodham.com, so my own test runs never count.

What would I do differently?

  • Budget lights and shader programs from the first day, and test on a Windows machine early. The 50-second first open came from lights I added for looks, and I only caught it when the room seemed not to open at all on Windows.
  • Use compressed GPU textures (KTX2) from the start. Uploading the 3D models' textures still takes about 1.2 s of the start-up.
  • Load only what a view needs. All four painted Dwarka layers load, though only two show at a time.
  • Write the making-of pages alongside the room. Until they existed, the details people ask about, like the window and the guitar, were invisible to search.

Questions people ask

Is a three.js portfolio bad for SEO?

Not if the words also ship as HTML. Crawlers cannot read a canvas and most AI crawlers do not run JavaScript, so the room's story is also in the page's HTML, on /about/ and in llms.txt. Search engines index the text; the 3D is for people.

How heavy is it, and how long does it take to load?

About 9.3 MB in 116 requests before the room is ready, most of it 3D models and textures. In headless Chrome on my PC it is ready in 6.5 to 7.4 s; a normal browser is usually quicker.

Does it drain the battery?

It draws nothing while a view is still. Small animations, like the steam over a cup or the temple flag, ask for 20 to 24 frames a second only while they are big on screen and the tab is visible.

Does it work on a phone?

Yes. It picks a quality level from your graphics chip (pixel ratio, anti-aliasing, ambient occlusion, bloom and shadow sizes), and the preset views have taller framings for portrait screens.

Is the window really live?

Yes. It reads your clock as Indian time and shows Dwarka's sky for that hour, with the moon in today's phase, repainted once a minute. Settings has a slider to pick another time of day.

Did you use AI to build it?

Yes. I designed and directed the room and built it with AI coding agents (Claude Code), and my avatar's head comes from a Meshy AI scan.