October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk8 min

How to Build and Test Three.js Scenes Without a Graphics-Heavy Setup

A browser-first Three.js workflow: build a primitive scene, test app behavior with Playwright, and understand what headless checks cannot prove.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can learn Three.js and test a small scene without starting with a dedicated graphics card or a complex 3D pipeline. Build a minimal browser app with a scene, camera, geometry, material, and renderer; use automated browser tests to check that the app loads and responds; then do a brief visual check in the browsers and devices you actually support. That last step matters: headless tests do not certify rendering quality or performance on someone else’s hardware.

What “without a graphics-heavy setup” means

It means keeping the scene and development workflow small—not removing the browser’s need to render graphics. Three.js draws the part of a scene visible to a camera onto a canvas. Its current WebGLRenderer uses WebGL 2, and the Three.js API documentation says WebGL 1 has not been supported since r163. Check that the browsers you intend to support can create a compatible rendering context before treating a blank canvas as a scene-code problem. Three.js WebGLRenderer reference

As an Amazon Associate I earn from qualifying purchases.

The official Three.js fundamentals guide demonstrates a browser-based ES module workflow and assumes familiarity with JavaScript. Start with one primitive and a simple material; add lighting, textures, shadows, and animation only when they answer the next question you need to test. Three.js fundamentals

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build a minimal scene in the browser

1. Create a small project

Use a local development server rather than opening an ES module file directly. One lightweight setup is Vite:

#1 Best Overall
Sale
GIGABYTE Radeon RX 9070 XT Gaming OC 16G Graphics Card, PCIe 5.0, 16GB GDDR6, GV-R9070XTGAMING OC-16GD Video Card
  • Powered by Radeon RX 9070 XT
  • WINDFORCE Cooling System
  • Hawk Fan
  • Server-grade Thermal Conductive Gel
  • RGB Lighting
npm create vite@latest three-mini -- --template vanilla
cd three-mini
npm install
npm install three
npm run dev

Use the local URL printed by Vite for the next steps. The server is for serving the app during development; it does not remove the browser’s graphics requirements.

2. Add a canvas and scene

Replace index.html with a page that contains a canvas and loads a module:

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Three.js mini scene</title>
    <style>
      html, body { margin: 0; min-height: 100%; background: #151923; }
      canvas { display: block; width: 100%; height: 100vh; }
    </style>
  </head>
  <body>
    <canvas id="scene" aria-label="Rotating cube scene"></canvas>
    <script type="module" src="/src/main.js"></script>
  </body>
</html>

Create src/main.js:

import * as THREE from 'three';

const canvas = document.querySelector('#scene');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));

const scene = new THREE.Scene();
scene.background = new THREE.Color(0x151923);

const camera = new THREE.PerspectiveCamera(45, 1, 0.1, 100);
camera.position.set(0, 0, 5);

const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshNormalMaterial();
const cube = new THREE.Mesh(geometry, material);
scene.add(cube);

function resize() {
  const width = canvas.clientWidth;
  const height = canvas.clientHeight;
  if (width === 0 || height === 0) return;
  renderer.setSize(width, height, false);
  camera.aspect = width / height;
  camera.updateProjectionMatrix();
}

window.addEventListener('resize', resize);
resize();

renderer.setAnimationLoop((time) => {
  cube.rotation.x = time * 0.0004;
  cube.rotation.y = time * 0.0006;
  renderer.render(scene, camera);
});

This deliberately uses a built-in box geometry and a material that does not require setting up lights. A mesh combines geometry and material, while its position, rotation, and scale are transforms in the scene graph. The camera must point at an object within its view frustum for the renderer to show it. Parent-child relationships in the scene graph make child transforms relative to their parents, and geometries or materials can be shared by multiple meshes. Three.js fundamentals

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The animation loop uses renderer.setAnimationLoop(), which the Three.js API advises using instead of a hand-written requestAnimationFrame() loop for compatibility. If animation is not part of what you are testing, you can render once after setup and after relevant scene changes instead. Three.js WebGLRenderer reference

Rank #2
GIGABYTE GeForce RTX 5070 Ti Gaming OC 16G Graphics Card, 16GB 256-bit GDDR7, PCIe 5.0, WINDFORCE Cooling System, GV-N507TGAMING OC-16GD Video Card
  • Powered by the NVIDIA Blackwell architecture and DLSS 4
  • Powered by GeForce RTX 5070 Ti
  • Integrated with 16GB GDDR7 256bit memory interface
  • PCIe 5.0
  • WINDFORCE cooling system

3. Confirm WebGL 2 early

If the canvas is blank, distinguish browser capability from a scene defect. A small capability check can make the failure explicit:

const gl = canvas.getContext('webgl2');
if (!gl) {
  document.body.dataset.webgl2 = 'unavailable';
  throw new Error('This browser did not provide a WebGL 2 context.');
}
document.body.dataset.webgl2 = 'available';

In a real app, avoid creating a context in a way that conflicts with the renderer’s own context creation. For example, a simple check on a separate temporary canvas can establish whether the browser exposes WebGL 2 before constructing the Three.js renderer. Treat an unavailable context as a capability issue to report clearly, not proof that the scene graph is broken.

Test behavior with browser automation

Browser automation is useful for repeatable checks of page loading and app behavior: module errors, canvas creation, controls, and other interactions. It is not a substitute for looking at the rendered result on a target browser/device.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install Playwright and its browser

npm install --save-dev @playwright/test
npx playwright install chromium

Playwright also documents a smaller CI installation option when using its headless shell: npx playwright install --with-deps --only-shell. If you need the newer headless mode, Playwright documents the chromium channel as using new headless Chrome. The headless shell and newer headless mode can behave differently; choose the one that fits your CI and fidelity needs. Playwright browser documentation

Rank #3
ASUS TUF Gaming GeForce RTX™ 5080 16GB GDDR7 OC Edition Graphics Card
  • Powered by the NVIDIA Blackwell architecture and DLSS 4. System Requirements: Minimum 850W PSU with 16-pin 12V-2x6 (12VHPWR) connector required. Verify before purchasing.
  • Military-grade components deliver rock-solid power and longer lifespan for ultimate durability. Compatibility: 348mm (13.7") length, 3.6 slots, 4.3 lbs. Confirm case clearance and slot spacing. GPU bracket included.
  • Protective PCB coating helps protect against short circuits caused by moisture, dust, or debris
  • 3.6-slot design with massive fin array optimized for airflow from three Axial-tech fans
  • Phase-change GPU thermal pad helps ensure optimal thermal performance and longevity, outlasting traditional thermal paste for graphics cards under heavy loads

Add an integration test

Create tests/scene.spec.js and add a test that visits the running app. This example assumes the Vite server is available at http://127.0.0.1:5173:

import { test, expect } from '@playwright/test';

test('scene page loads and creates its canvas', async ({ page }) => {
  const pageErrors = [];
  page.on('pageerror', error => pageErrors.push(error.message));

  await page.goto('http://127.0.0.1:5173');
  await expect(page.locator('canvas#scene')).toBeVisible();
  await expect(page.locator('body')).toHaveAttribute('data-webgl2', 'available');
  expect(pageErrors).toEqual([]);
});

Run the Vite server in one terminal, then run the test with:

npx playwright test

Extend the test to exercise actual controls or application states—for example, verify that a button changes a displayed setting—rather than asserting only that a canvas element exists. A canvas can be present even if the camera misses the object or the scene is visually wrong. Console messages, failed assets, and screenshots can also help diagnose browser-level failures, but pixel output still needs interpretation in the context of the browser and rendering environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Validate appearance and complexity separately

Do a visual smoke test on a real target

Keep at least a small manual check in a real target browser and device. Confirm that the object is visible, the canvas fits the viewport, resizing works, and the interaction or animation you care about looks right. The appropriate matrix depends on your intended users and deployment; no specific minimum hardware or tested browser/device matrix is established here.

Rank #4
Sale
ASUS Dual GeForce RTX 5060 Ti 16GB GDDR7 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1b, 2.5-slot, Axial-tech Fans, 0dB Technology, Dual BIOS
  • AI Performance: 767 AI TOPS
  • OC mode: 2632 MHz (OC mode)/ 2602 MHz (Default mode)
  • Powered by the NVIDIA Blackwell architecture and DLSS 4
  • Axial-tech fan design features a smaller fan hub that facilitates longer blades and a barrier ring that increases downward air pressure
  • A 2.5-slot design maximizes compatibility and cooling efficiency for superior performance in small chassis

For choosing a test environment, consider browser/version fidelity, WebGL 2 availability, whether the environment uses a real GPU or software fallback, CI download and storage footprint, whether you can inspect pixels or screenshots, and how closely the setup resembles production. Playwright documents browser automation choices, but those choices do not provide a universal graphics-speed benchmark or guarantee feature parity on every CI host. Playwright browser documentation

Inspect renderer statistics

Three.js exposes renderer.info for renderer statistics, including render calls, triangles, points, lines, and GPU memory-related information. Use those values to spot changes in scene complexity as you add objects or resources; they are diagnostics, not frame-rate guarantees for another machine. If the first draw pauses while materials compile, renderer.compileAsync(scene, camera) can prepare scene materials before rendering and resolves when rendering can proceed without unnecessary shader-compilation stalls. Three.js WebGLRenderer reference

Keep performance investigations tied to the actual browser/device and scene conditions you care about. A low-complexity test scene can help isolate a problem, but passing it does not prove a more complex production scene will run smoothly elsewhere.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshooting

  • Blank page or module import error: Confirm the local server is running, dependencies are installed, and the browser is loading src/main.js as a module. Check the browser console for the first error rather than debugging the canvas first.
  • Canvas appears but no object is visible: Confirm the mesh was added to the scene, the camera is aimed at it, its position is within the camera’s near/far range, and the renderer is called after setup.
  • WebGL 2 context is unavailable: Test the target browser and its graphics configuration. Report this as a capability limitation; Three.js WebGLRenderer does not support WebGL 1 since r163. Three.js WebGLRenderer reference
  • Test passes but the visual output is wrong: The assertion may only confirm the page or canvas exists. Add interaction assertions and inspect the result in the target browser/device; headless automation is not a guarantee of visual correctness across environments.
  • First render stalls: If shader compilation is the cause, prepare materials with compileAsync(scene, camera) before the render path that must avoid the compilation pause. It does not optimize all scene work or guarantee a particular frame rate. Three.js WebGLRenderer reference
  • Resizing distorts the scene: Update the renderer size and camera aspect ratio together, then call camera.updateProjectionMatrix(). Avoid sizing from a zero-width or zero-height canvas.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is to capture the rendered page rather than configure a browser capture workflow, ScreenshotNeo is a website screenshot API and MCP server. It can capture an accessible Three.js page, but a screenshot is not a replacement for automated interaction tests or validation on your target hardware.

Best Value
GIGABYTE GeForce RTX 5060 WINDFORCE OC 8G Graphics Card, Cooling System, 8GB 128-bit GDDR7, PCIe 5.0, Manufactured by NVIDIA, DisplayPort & HDMI - Video Output Interface, GV-N5060WF2OC-8GD Video Card
  • Powered by the NVIDIA Blackwell architecture and DLSS 4
  • Powered by GeForce RTX 5060
  • Integrated with 8GB GDDR7 128bit memory interface
  • PCIe 5.0
  • WINDFORCE cooling system

One GET request returns an image or PDF. For example, this cURL call captures a URL as WebP; see the ScreenshotNeo API documentation for options:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
  • Cookie/consent banners are accepted and removed, along with 60+ known consent platforms, newsletter popups, and chat widgets; each step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.
  • The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Can Three.js run outside a browser?

This workflow uses Three.js in a browser. The relevant renderer requires a browser environment that can provide WebGL 2; a browser-free setup is not established by the sources cited here.

Does a Playwright headless test prove my scene will be fast on a low-end device?

No. It checks behavior in its browser environment, not performance on a particular user’s device. Test the scene on the target browsers and devices you intend to support.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

SaleBestseller No. 1
GIGABYTE Radeon RX 9070 XT Gaming OC 16G Graphics Card, PCIe 5.0, 16GB GDDR6, GV-R9070XTGAMING OC-16GD Video Card
GIGABYTE Radeon RX 9070 XT Gaming OC 16G Graphics Card, PCIe 5.0, 16GB GDDR6, GV-R9070XTGAMING OC-16GD Video Card
Powered by Radeon RX 9070 XT; WINDFORCE Cooling System; Hawk Fan; Server-grade Thermal Conductive Gel
$814.99
Bestseller No. 2
GIGABYTE GeForce RTX 5070 Ti Gaming OC 16G Graphics Card, 16GB 256-bit GDDR7, PCIe 5.0, WINDFORCE Cooling System, GV-N507TGAMING OC-16GD Video Card
GIGABYTE GeForce RTX 5070 Ti Gaming OC 16G Graphics Card, 16GB 256-bit GDDR7, PCIe 5.0, WINDFORCE Cooling System, GV-N507TGAMING OC-16GD Video Card
Powered by the NVIDIA Blackwell architecture and DLSS 4; Powered by GeForce RTX 5070 Ti; Integrated with 16GB GDDR7 256bit memory interface
$1,249.99
Bestseller No. 3
ASUS TUF Gaming GeForce RTX™ 5080 16GB GDDR7 OC Edition Graphics Card
ASUS TUF Gaming GeForce RTX™ 5080 16GB GDDR7 OC Edition Graphics Card
3.6-slot design with massive fin array optimized for airflow from three Axial-tech fans; Auto-Extreme precision automated manufacturing helps ensure higher reliability
$1,829.99
SaleBestseller No. 4
ASUS Dual GeForce RTX 5060 Ti 16GB GDDR7 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1b, 2.5-slot, Axial-tech Fans, 0dB Technology, Dual BIOS
ASUS Dual GeForce RTX 5060 Ti 16GB GDDR7 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1b, 2.5-slot, Axial-tech Fans, 0dB Technology, Dual BIOS
AI Performance: 767 AI TOPS; OC mode: 2632 MHz (OC mode)/ 2602 MHz (Default mode); Powered by the NVIDIA Blackwell architecture and DLSS 4
$771.53
Bestseller No. 5
GIGABYTE GeForce RTX 5060 WINDFORCE OC 8G Graphics Card, Cooling System, 8GB 128-bit GDDR7, PCIe 5.0, Manufactured by NVIDIA, DisplayPort & HDMI - Video Output Interface, GV-N5060WF2OC-8GD Video Card
GIGABYTE GeForce RTX 5060 WINDFORCE OC 8G Graphics Card, Cooling System, 8GB 128-bit GDDR7, PCIe 5.0, Manufactured by NVIDIA, DisplayPort & HDMI - Video Output Interface, GV-N5060WF2OC-8GD Video Card
Powered by the NVIDIA Blackwell architecture and DLSS 4; Powered by GeForce RTX 5060; Integrated with 8GB GDDR7 128bit memory interface
$497.06

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.