Creating a scene
In Chapter 1, Creating Your First 3D Scene with Three.js, you created a THREE.Scene
, so you 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 (discussed in detail in Chapter 3, Working with Light Sources in Three.js).
- 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 you want to render. THREE.Scene
itself doesn&...