Graphics Reference
In-Depth Information
var ambientLight = new
THREE.AmbientLight(0x332222);
This will create the light source. When you create the ambient light, you can
specify its color as a hex value. Don't specify it too high; if you do, your whole
scene will be very bright.
2. The only thing left to do is add this light to the scene:
scene.add(ambientLight);
With these two very simple steps, you've created
THREE.AmbientLight
.
How it works...
THREE.AmbientLight
works in a very simple way. When you create
THREE.AmbientLight
, you pass in a color (in hex) into its constructor. When the
scene is rendered, Three.js just blends in the specified color to the color of any of
your meshes.
See also
• Even though
THREE.AmbientLight
can be used to soften the lighting
in a scene, it's hard to create natural-looking lighting. In the
Using
THREE.HemisphereLight for natural lighting
recipe, we show you how to use
a different light source for natural outside lighting.