...

/

Adding Lights and Meshes

Adding Lights and Meshes

Add lights, meshes, and geometrical shapes with materials and shadow configurations to a Three.js scene.

Adding lights 

If we don’t have lights in the scene, most materials will be rendered in black. So, to see our meshes (and get shadows), we’re going to add some lights to the scene. In this case, we’re going to add two lights: 

  • THREE.AmbientLight: This is just a simple light that affects everything with the same intensity and color. 

  • THREE.DirectionalLight: This is a light source whose rays are cast in parallel to one another. This is pretty much how we experience the light of the Sun.

The following code fragment shows how to do this:  ...