O'Reilly logo

Three.js Essentials by Jos Dirksen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding directional and ambient lighting

Three.js offers a number of different types of light. The following table shows the most important lights that are available:

Name

Description

AmbientLight

A simple light whose color is added to the color of an object's material.

PointLight

A single point in space that emanates light evenly in all directions.

SpotLight

A light with a cone effect, for instance, a spot in the ceiling or a torch.

DirectionalLight

A light that acts like a very remote light source. All light rays run parallel to each other. The sun, for instance, can be seen as an infinite source of light.

Before we create the lights, we first need to change the material. In the previous example, we used THREE.MeshBasicMaterial ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required