Scene
Quick answer
Scene is the root of the scene graph, holding meshes, lights, background, environment, and fog. It has no geometry or material of its own; add objects to it, choose a background or environment map, and traverse it to update or dispose of contents.
new THREE.Scene () → Scene
Key points
- background accepts a Color, Texture, or CubeTexture; null makes it transparent with alpha: true.
- environment supplies reflections for MeshStandardMaterial via a PMREM-processed texture.
- overrideMaterial forces one material across the scene for debugging or depth passes.
Example
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x0d1117);
scene.fog = new THREE.Fog(0x0d1117, 400, 1800);
const pmrem = new THREE.PMREMGenerator(renderer);
const envTarget = pmrem.fromScene(new RoomEnvironment(), 0.04);
scene.environment = envTarget.texture;
pmrem.dispose();scene.traverse(function (obj) {
if (obj.isMesh) {
obj.castShadow = true;
obj.receiveShadow = true;
}
});
const roof = scene.getObjectByName('roof_level_3');
Notes
- clear() detaches children without disposing geometry, materials, or textures.
- Scene inherits Object3D transforms; moving it shifts background and fog references unexpectedly.
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Atlaslog (2026). Scene. https://www.jingweizhi.com/en/three/api/scene.html (accessed 2026-11-03).