The lighting is helping a bit in understanding the dimensionality of the scene but it is not great at this point as it is missing shadows. Rendering a shadow in three.js is unfortunately not too straightforward. This is because shadows are computationally expensive and we need to activate shadow rendering on multiple places. The renderer needs to start rendering shadows, the objects need to cast or receive shadows, and the light needs to cast shadows as well. After setting all this up, you should start seeing shadows in the scene.
- [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.
- Building a simple scene
- Creating three.js 3D objects
- Adding light and shadows
- Animating with Tween.js
- Working with materials and textures
- Editing and importing geometries
- Creating a particle system
- Post-processing with effects and shaders
Skill Level Intermediate
Flash Professional: HTML5 Canvas and WebGLwith Joseph Labrecque1h 36m Intermediate
HTML5: Graphics and Animation with Canvaswith Joe Marini3h 7m Intermediate
1. Building a Simple Scene
2. Three.js Scene Object
5. Materials and Textures
Next steps1m 53s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.