Three.js By Example
Three.js By Example


This book is no longer available for sale.

Three.js By Example

This book is 40% complete

Last updated on 2013-12-11

About the Book

The OpenGL tutorials from Nehe Productions is a resource that I've returned to many times since I discovered it early in my college career. When learning a new 3D graphics library, I often try to to port a couple of the tutorials to get my bearings.

WebGL and many of its associated libraries suffer from a dearth of documentation. Things aren't as bad as they were before I wrote Learning HTML5 Game Programming for Pearson/Addison-Wesley but you can never have too much documentation.

This book seeks to be that kind of resource for using Three.js, a WebGL scene graph library for creating 3D in the browser.

About the Author

James Williams
James Williams

James Williams is a developer based in Silicon Valley and frequent conference speaker and is the author of book "Learning HTML5 Game Programming" for Addison-Wesley. You can find him on Google+ at and he tweets as @ecspike.

Table of Contents

  • Introduction to CoffeeScript
    • What is CoffeeScript?
    • Basics
    • Classes
    • Scoping
    • Why use CoffeeScript ?
    • Summary
  • Lesson 01 - Getting Started
    • What is WebGL?
    • What is Three.js?
    • Viewing the World
    • Complete file
  • Lesson 02 - Drawing Basic Objects
    • Creating Meshes
  • Lesson 03 - Working with color
    • Vertex Colors
    • Setting object colors
  • Lesson 04 - Moving objects
    • Object Transformations
    • Transformation Order
    • The Code
  • Lesson 05 - Creating Objects Programmatically
  • Lesson 06 - Working with Textures
    • Texture Coordinates
  • Lesson 10 - Walking Through A 3D World
    • Building the Walls
    • Moving the Camera
  • Lesson 12 - Creating Duplicate Objects
    • TODO - Create and instantiate an object class
  • Lesson 13 - Working with 3D Text
    • Creating the Text
    • Specifying a font
    • Size vs height
    • Materials
    • Dealing with Errors
  • Lesson 15 - Using Custom Fonts
    • What is typeface.js?
    • Using typeface.js
    • Where to find free fonts?
    • WOFF vs OTF vs TTF
    • Converting WOFF to OTF/TTF
  • Lesson 16 - Working with Fog
  • Lesson 19 - Particle Systems
  • Loading Blender Models in Three.js
    • How to install the plugin
    • Exporting a Model
    • JSON Format
    • Loading Models
    • Loading Scenes
    • Where to find Blender models
    • Caveats
  • Adding Physics to a Scene
    • What is Physijs?
    • Getting Started with Physijs
    • Creating a Physijs Model
    • Creating Physijs Models from a File
    • Types of Meshes
    • Adding forces to objects
  • Creating A Simple Game
    • Loading Models
    • Collision Detection
    • Making the Game Social
  • Using the Three.js Editor
    • Walkthough of Interface
    • Adding Objects
    • Working with Materials and Textures
    • Disadvantages
    • Exporting Assets
    • Summary
  • Shaders
    • Introduction
    • What is GLSL?
    • Shader Programs
    • Your First Shader Program
    • Communicating between shaders
    • Examining Shaders
  • Misc
  • WebGL Inspector
    • Installing WebGL Inspector
    • Walkthrough of Features

Other books by this author

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Write and Publish on Leanpub

Authors, publishers and universities use Leanpub to publish amazing in-progress and completed books and courses, just like this one. You can use Leanpub to write, publish and sell your book or course as well! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub