Getting Started

Start a new project in 3DE. Choose the 3D starter project (with Animation) template from the menu. Then save it with the name Moon Phases.

Before coding, let’s dial down the brightness of the ambient light that’s automatically added to our scene.

​ ​var​ scene = ​new​ THREE.Scene();
​ ​var​ flat = {flatShading: ​true​};
»​var​ light = ​new​ THREE.AmbientLight(​'white'​, 0.1);
​ scene.add(light);

There is some ambient light in space—especially that reflected light near planets and moons. But nearly all of the light in the solar system comes from the Sun. We’ll add the Sun shortly.

In addition to changing the light, let’s also switch to an orthographic camera. When we talked about these ...

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.