Chapter 3. Three.js—A JavaScript 3D Engine

The previous chapter demonstrated both the power and complexity of programming in WebGL. WebGL allows access to the full capabilities of the GPU to create beautiful real-time 3D renderings and animations in web pages. But to do anything more than the most basic tasks using the API out of the box requires serious effort and literally hundreds of lines of code. This is not a recipe for rapidly building applications on web time. Depending on the kind of project you are contemplating, most developers are faced with a choice: build your own helper library to ease the pain, or use any one of several libraries already out there.

While there are many choices for getting started with your WebGL development, the undisputed leader in this category is Three.js. Three.js provides an easy, intuitive set of objects that are commonly found in 3D graphics. It is fast, using many best-practice graphics engine techniques. It is powerful, with several built-in object types and handy utilities. It is open source, hosted on GitHub, and well maintained, with several authors contributing to it.

Three.js has become something of a de facto choice for WebGL development. Most of the great WebGL content you can view online has been built with it, including Google’s 100,000 Stars (see Chapter 1), and several rich and highly innovative works live on the Web today.

Three.js Flagship Projects

Perhaps the most well-known WebGL project to date is RO.ME “3 Dreams of Black”, an ...

Get Programming 3D Applications with HTML5 and WebGL now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.