Learning Three.js – the JavaScript 3D Library for WebGL - Second Edition
Learning Three.js provides a thorough guide to creating 3D graphics with JavaScript and Three.js. It covers key techniques such as adding lighting, shadows, and materials, as well as loading, animating, and customizing 3D models. Each topic is supported by clear examples that can be tailored to fit a wide range of projects. Designed for JavaScript developers ready to explore 3D programming, this book assumes basic knowledge of JavaScript and HTML, requiring no background in advanced math or WebGL.
- ISBN 9781784391027
- Jos Dirksen
- Packt Publishing Ltd
LearningThree.js is written by Jos Dirksen, a seasoned software developer and architect with over a decade of experience in a variety of technologies, including backend systems such as Java and Scala, as well as frontend technologies like HTML5, CSS, and JavaScript. His expertise is complemented by his involvement in the tech community through conference speaking and blogging. Dirksen has authored several books on the Three.js library, including Three.js Essentials and Three.js Cookbook.
LearningThree.js is ideal for JavaScript developers who want to create 3D graphics in a browser. No prior experience with WebGL or advanced mathematics is needed. All examples in the book can also be found on the author’s GitHub page: github.com/josdirksen/learning-threejs.
To work through the examples, a simple text editor and standard web browser are all that's required. In some instances, a lightweight local web server is necessary with setup instructions provided in the book.
The book is divided into 12 chapters that cover everything from creating your first 3D scene to advanced topics like custom shaders and physics simulations:
Chapter 1 explains how to create your first 3D scene using Three.js. It guides you through setting up and animating a basic scene in your browser.
Chapter 2 introduces the essential parts of a Three.js scene. It covers lights, meshes, geometries, materials, and cameras, providing a foundation for understanding scenes.
Chapter 3 focuses on light sources available in Three.js. It describes how to use spotlights, directional lights, ambient lights, point lights, hemisphere lights, and area lights. Lens flare effects are also explained.
Chapter 4 explores the materials you can use on meshes in Three.js. It shows how to configure material properties and includes examples for testing materials interactively.
Chapter 5 discusses basic geometries available in Three.js. You learn to create and adjust shapes like planes, circles, cubes, and spheres using hands-on examples.
Chapter 6 continues with advanced geometries. It covers convex and lathe shapes, creating 3D objects from 2D shapes, and combining geometries through binary operations.
Chapter 7 looks at point clouds, sprites, and particle systems. It explains how to create, modify, and style point clouds using sprites and special materials.
Chapter 8 teaches how to import and save meshes and geometries. It explains the use of Three.js JSON format and how to load files from other formats, including OBJ, DAE, and STL.
Chapter 9 introduces animations and camera movements. Techniques include using Tween.js and animating models with morph and skeleton-based methods.
Chapter 10 explains textures. It covers applying and controlling textures, including using HTML5 video and canvas as texture sources.
Chapter 11 explains custom shaders and postprocessing. You learn to apply effects like blur or sepia and create custom shaders for unique visual effects.
Chapter 12 covers adding physics and sounds. It explains collision detection, gravity, friction, and using the Physijs library for physics. Adding positional audio to a scene is also explained.
Jos Dirksen’s books on Three.js are excellent resources for anyone looking to dive into browser-based 3D graphics. What stands out is how quickly you can start creating something meaningful — even the first few chapters provide enough knowledge to build functional 3D scenes.
The text is written in an approachable and easy-to-follow style, making it accessible to readers with little or no prior knowledge with Three.js or 3D graphics programming.
All in all, if you're interested in learning browser-based 3D graphics using Three.js, I highly recommend this book.