From the course: Learning 3D Graphics on the Web with Three.js

Shadows

- [Instructor] The lighting is helping a bit in understanding the dimensionality of the scene but it's not great at this point. We are missing a crucial element of lighting, the shadows. Rendering your shadow in Three.js is unfortunately not too straightforward. This is because shadows are conditionally expensive and we need to activate shadow rendering on multiple places. First we need to tell the renderer to start rendering shadows. And then we need to tell the light to cast shadows. So I will find my lights in the scene which is the Point Lights and I will make it cast shadows. Then we should also tell the objects to cast or receive shadows. In our case we will make the box cast shadows and the plane to receive shadows. So let's find the box object. And on the mesh I will make it cast the shadow. And I will find the plane object which is here, and I will make it receive a shadow. And after all these settings we should start seeing shadows in the scene. Next let's take a look at the other light types that are available in Three.js.

Contents