July 2018
Beginner to intermediate
374 pages
8h 54m
English
To increase the realism, let’s add a “point light,” which is kind of like a light bulb. Add the code for our point light below the donut code.
| | var point = new THREE.PointLight('white', 0.8); |
| | point.position.set(0, 300, -100); |
| | scene.add(point); |
We’re positioning the light above and behind the donut. The point light is bright, but not too bright at 0.8. The result should be a pretty cool-looking donut:

One weird thing about programming with 3D lights is that the light is not coming from an object in the scene. We positioned the source of the light at X-Y-Z coordinates of (0, 300, -100). The light comes from here, but there’s ...
Read now
Unlock full access