Shadow
Code on this page is illustrative and omits imports and application setup. See the embedded live demos for complete runnable examples.
Shadows add depth and realism to scenes. Currently, we support casting shadows with directional, point, and spotlight sources.
Enable shadow
Each light source can be individually configured to cast shadows or not, along with settings for shadow mode and quality parameters.
javascript
const light = new DirectionalLight(scene);
// The castShadow property controls whether the light casts shadows
light.castShadow = true;Meshes can also be configured to cast shadows or not.
javascript
// Allow this mesh to cast shadows
// Default value is true
mesh.castShadow = true;