New advertisers: 50% off your first month with code FIRSTMONTHSee slots
cloudai-x avatar

Threejs Fundamentals

Core scene setup for three.js: scenes, cameras, the renderer, the animation loop, and object transforms.

skills.sh installs
24.2K
GitHub stars
4.3K
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers scene and fog setup, four camera types, WebGLRenderer configuration, and Object3D hierarchies and transforms
  • Includes import-map setups for both WebGLRenderer and WebGPURenderer with TSL, targeting three.js r186
  • Enforces updateProjectionMatrix() after changing camera fov, aspect, near, or far values
  • Designed for developers creating a three.js scene from scratch, configuring cameras or renderers, or arranging objects

Install

$ npx -y skills add cloudai-x/threejs-skills --skill threejs-fundamentals -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Three.js Fundamentals

Targets three.js r186. Examples use WebGLRenderer; the WebGPU and TSL section uses WebGPURenderer.

Quick Start

import * as THREE from "three";

const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

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

const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(0, 1.5, 5);

const cube = new THREE.Mesh(
  new THREE.BoxGeometry(1, 1, 1),
  new THREE.MeshStandardMaterial({ color: 0x3a86ff }),
);
scene.add(cube);
const light = new THREE.DirectionalLight(0xffffff, 2);
light.position.set(3, 4, 5); // shines from its position toward the origin
scene.add(light);
scene.add(new THREE.AmbientLight(0xffffff, 0.4));

const timer = new THREE.Timer();
timer.connect(document); // freezes the delta while the tab is hidden

Details

Repository
github.com/cloudai-x/threejs-skills
Categories
3D, CAD & Modeling, Frontend & UI Code

More from cloudai-x/threejs-skills

All 10

Similar to Threejs Fundamentals

More 3D, CAD & Modeling