Making a Website with Three.js: From Your First Scene to a Real Page
A practical starting guide to websites with Three.js: when 3D is worth it, the three building blocks, your first working scene, and the rules for real pages.

TL;DR: A website with Three.js is an ordinary website plus one WebGL canvas that earns its place. You need exactly three building blocks to start: a scene, a camera, and a renderer. Everything else, models, controls, materials, is layering. The hard part is not the first scene; it is keeping the page fast, readable, and useful around it.
First, an Honest Filter: Does This Website Need 3D?
Three.js is worth its cost when the visitor needs to inspect something spatial: a building's massing, a machine's internals, a product's configuration. It is not worth it for decoration. A rotating logo teaches the visitor nothing and taxes every phone that opens the page.
The test I use with clients: name the decision the 3D helps the visitor make. On the Genç Group site, the 3D lab helps an investor judge a building's form, facade, and light. The automotive section helps a customer understand a 4-stage engineering process. Both pass the test. A spinning hero object would not.
The Three Building Blocks
Every Three.js page, from a demo to a production platform, is these three:
- Scene: the container. Everything you render, meshes, lights, groups, lives inside it.
- Camera: the visitor's eye. A perspective camera with a field of view around 40 to 50 degrees reads naturally for buildings and products.
- Renderer: the WebGL engine that draws the scene through the camera onto a canvas, roughly 60 times a second.
import * as THREE from "three";
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 500);
camera.position.set(12, 8, 14);
camera.lookAt(0, 0, 0);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(width, height);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
const light = new THREE.DirectionalLight(0xffffff, 2.4);
light.position.set(15, 20, 8);
scene.add(light, new THREE.AmbientLight(0xffffff, 0.5));
const building = new THREE.Mesh(
new THREE.BoxGeometry(8, 12, 8),
new THREE.MeshStandardMaterial({ color: 0xd8cfc0 })
);
building.position.y = 6;
scene.add(building);
renderer.setAnimationLoop(() => renderer.render(scene, camera));That is a lit, rendered object on a web page. Everything in the longer tutorials is refinement of this skeleton: real models instead of boxes, controls instead of a fixed camera, state instead of constants.
From Box to Real Model
Real projects load models instead of building geometry in code. The working format is glTF (.glb), ideally with Draco compression so the file stays small enough for a phone connection. You load it, add it to the scene, and the box example's lighting and camera carry over unchanged. Preparation matters more than code here: merged static parts, baked ambient occlusion, and a polygon budget set for mobile first. The full treatment is in how to build an interactive 3D website, step by step.
Putting the Canvas Inside a Real Page
A demo fills the screen. A website section does not. The differences that matter:
- The canvas gets a box, not the viewport. A defined aspect-ratio container inside the layout, so text, navigation, and the call to action keep their places.
- The page works without it. Headings, descriptions, and contact paths are normal HTML. The canvas is an enhancement layered into the page, loaded late, with a poster image standing in until it starts.
- Touch belongs to the visitor. Orbit controls respond inside the canvas; the page still scrolls. Fighting the scroll gesture is the fastest way to make a 3D site feel broken on a phone.
- Frameworks need a boundary. In Next.js, the canvas lives in a client component loaded dynamically, because Three.js assumes a browser and the framework renders on a server first. That integration has its own guide: Three.js in Next.js.
The Ground Rules That Separate Demos from Websites
- Mobile is the budget. If it does not run smoothly on a mid-range phone, it does not ship. Cap the pixel ratio, compress the model, and test on the phone, not the workstation.
- One scene, few lights. A directional light plus ambient covers most product and architecture work. Every extra real-time light is a per-frame cost.
- Dispose what you allocate. Leaving a 3D section should free its GPU memory, or the tab gets slower the longer the visit lasts.
- Text sells, canvas proves. Search engines and many visitors meet the words first. Write the page so it convinces without a single rendered frame, then let the 3D close the argument.
Where to Go Next
If your subject is a building or a development project, the specialised version of this guide is the architecture website tutorial. For a complete shipped example, the Genç Group case study shows this approach running as a trilingual corporate platform. And if you want the 3D built into your own site rather than as an exercise, that is exactly the interactive 3D website development service.
Thinking about a 3D section for your own website?
Tell me what your visitors need to inspect on WhatsApp, a building, a product, a process, and I will tell you if Three.js is the right tool and what it involves.
Healix Medical: 5-Language International Patient Coordination Platform
Case study: 5-language patient coordination platform in Istanbul. 355 pages in the live sitemap, Arabic RTL, 33 contracted healthcare facilities.
QR Attendance System
QR attendance system built by Hamed Mohamed for 1,713 users (1,666 students, 40 academics, 7 admins) across 6 faculties: 98% latency reduction, 99.9% uptime.