Search code examples
three.jslighting

Three.js less intense ambient light?


I have a solar system simulator I'm working on in Three.js where the sun has a PointLight at its center with an intensity of 2.5. This looks great while the planets are facing the sun, but the rest of the planet is completely dark. Is there any way I can add some kind of ambient light source that is less intense than the PointLight but bright enough to show some detail on the dark side of the planets?

Dark side of planet


Solution

  • Ambient light with a low color value (in hex this is between 0x000000 to around 0x666666) lightens up everything in your scene:

    var ambientLight = new THREE.AmbientLight( 0x222222 );

    In Three.js there is also Hemisphere Light which works like Ambient but you can control the light from top and the one coming from the bottom seperatly.

    It is used to fake the reflection of light from the ground and adds a little more depth to your scene than just pure ambient light. See this demo for an example, also including a directional Light: http://threejs.org/examples/webgl_lights_hemisphere.html