Three.js By Example
Three.js By Example

Retired

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 http://jameswilliams.be/+ 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 App.coffee 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

Authors have earned$9,425,821writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

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

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! 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