Ambient Light
First, letâs add some âambientâ light to the scene. A scene is rarely completely black. Thereâs usually a little bit of illumination.
The light that we commented out at the very top of our code is that kind of light. So, letâs uncomment it and change its brightness from a fairly high 0.8 (1.0 is maximum brightness) to a dim 0.1 (0.0 is no light).
» | âvarâ light = ânewâ THREE.AmbientLight(â'white'â, 0.1); |
» | scene.add(light); |
If you hide the code, you can see that this amount of ambient light is just barely enough to see the donut. That probably seems too dark, but itâs perfect when working with other lights. That is just what weâll do in the next section!
Get 3D Game Programming for Kids, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.