O'Reilly logo

Three.js Essentials by Jos Dirksen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Combining with a starry background

There are different approaches you can take to set up a background in Three.js. We could, for instance, create a very large cube, apply a texture to the inside of the cube, and make sure it encompasses our globe. In our case, however, we'll use an approach that'll show you a very interesting feature of Three.js: the THREE.OrthographicCamera object. With an orthographic camera, all elements in the scene are rendered in the same size regardless of how far it is from the camera. This is, for instance, the effect you see in some older games, such as Baldur's Gate or Civilization. We'll use this camera to show a scene where we can create a plane geometry on which we will define a starry texture. So, first off, let's ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required