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

Creating a minimal Three.js web application

At this point, you'll have the source code and a locally running web server. Now, let's look at the basics of Three.js to prepare you for the examples in the following chapters. In this section, we'll introduce you to a basic Three.js scene and the basic building blocks.

Creating a scene to contain all the objects

Let's start with a minimal Three.js scene where we'll show you the following:

  • How to include the correct libraries
  • How to create a THREE.Scene object
  • How to add a THREE.Camera object
  • How to set up a render loop

The source code that the following example refers to is the 01.01-basic-scene.html file. The first thing that we need to do is include the Three.js JavaScript library. This is described in ...

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