Search⌘ K
AI Features

Creating a Scene with Basic Functionality

Explore how to create a basic Three.js scene by understanding essential components like the camera, lights, meshes, and renderer. Learn to set up a scene graph including grouping objects, and implement a render loop with interactive controls for viewing 3D scenes dynamically.

Creating a scene

We have learned how to create THREE.Scene, so we already know some of the basics of Three.js. We saw that for a scene to show anything, we need four different types of objects:

  • Camera: This determines which part of THREE.Scene is rendered onscreen.

  • Lights: These have an effect on how materials are shown and are used when creating shadow effects.

  • Meshes: These are the main objects that are rendered from the perspective of the camera. These objects contain the vertices and faces that make up the geometry (for example, a sphere or a cube) and contain a material, which defines what the geometry looks like. 

  • Renderer: This uses the camera and the information in the scene to draw (render) the output on the screen. 

THREE.Scene serves as the main container for the lights and the meshes we want to render. THREE.Scene itself doesn’t have that many options and functions. 

THREE.Scene is a structure ...