Introduction
First things first, but not necessarily in that order.
— Doctor Who from Meglos (1980)

About the Online Edition

What you are reading was originally a book. Nowadays, most learning about technical topics such as 3D math and video game programming is done online, so some readers may have a tough time visualizing what a technical book might have looked like. If this describes you, see Figure 1.

Figure 1Physical media was once used to communicate technical knowledge

It contained such anachronistic features as an ISBN number, an index, a bibliography, numbered chapters, sections, and pages, and strings of prose not broken up into 280-character chunks, such as the run-on-sentence you are now reading. This physical manifestation of knowledge weighed over 4 lbs, giving it many advantages over online form factors. It could be used to prop open a door or support a monitor at a desired height. You could collect physical books and display them on a shelf as an expression of your identity—real or aspired—and this worked whether or not you had actually read them! But the greatest advantage of a physical book was that you could tell at a glance how long it was. You are reading an 850 page book.

Also, this book was published in 2011. In 2011, League of Legends was two years old, Skyrim had just been released, and the PS4 was still two years away. But we're proud to say that most of the material in this book, like Bilbo when he still had The Ring, hasn't aged a day. Vectors and matrices work the same way, F still equals ma , and people still use Blinn-Phong.

However, some parts of the book are starting to showing their age a bit. The two least theoretical and most practical chapters (Chapters 10 and 12) in particular could benefit from an update and a shift of emphasis. We don't cite any publication or website younger than a decade. The jokes and cultural references—borderline to begin with—are now all dated. We'll be working on this; you can help by providing feedback.

Who Should Read This Book

This book is about 3D math, the geometry and algebra of 3D space. It is designed to teach you how to describe objects and their positions, orientations, and trajectories in 3D using mathematics. This is not a book about computer graphics, simulation, or even computational geometry, although if you plan on studying those subjects, you will definitely need the information here.

This is not just a book for video game programmers. We do assume that a majority of our readers are learning for the purpose of programming video games, but we expect a wider audience and we have designed the book with a diverse audience in mind. If you're a programmer or interested in learning how to make video games, welcome aboard! If you meet neither of these criteria, there's still plenty for you here. We have made every effort to make the book useful to designers and technical artists. Although there are several code snippets in the book, they are (hopefully) easy to read even for nonprogrammers. Most important, even though it is always necessary to understand the surrounding concepts to make sense of the code, the reverse is never true. We use code samples to illustrate how ideas can be implemented on a computer, not to explain the ideas themselves.

The title of this book says it is for “game development,” but a great deal of the material that we cover is applicable outside of video games. Practically anyone who wants to simulate, render, or understand a three-dimensional world will find this book useful. While we do try to provide motivating examples from the world of video game development, since that is our area of expertise and also our primary target audience, you won't be left out if the last game you completed was Space Quest.1 If your interests lie in more “grown up” things than video games, rest assured that this book is not filled with specific examples from video games about head-shots or severed limbs or how to get the blood spurt to look just right.

Why You Should Read This Book

This book has many unique features, including its topic, approach, authors, and writing style.

Unique topic. This book fills a gap that has been left by other books on graphics, linear algebra, simulation, and programming. It's an introductory book, meaning we have focused our efforts on providing thorough coverage on fundamental 3D concepts—topics that are normally glossed over in a few quick pages or relegated to an appendix in other books (because, after all, you already know all this stuff). We have found that these very topics are often the sticking points for beginners! In a way, this book is the mirror image of gluing together books on graphics, physics, and curves. Whereas that mythical conglomeration would begin with a brief overview of the mathematical fundamentals, followed by in-depth coverage of the application area, we start with a thorough coverage of the math fundamentals, and then give compact, high-level overviews of the application areas.

This book does try to provide a graceful on-ramp for beginners, but that doesn't mean we'll be stuck in the slow lane forever. There is plenty of material here that is traditionally considered “advanced” and taught in upper-level or graduate classes. In reality, these topics are specialized more than they are difficult, and they have recently become important prerequisites that need to be taught earlier, which is part of what has driven the demand for a book like this.

Unique approach. All authors think that they strike the perfect balance between being pedantic and being chatty in order to best reach their audience, and we are no exception. We recognize, however, that the people who disagree with this glowing self-assessment will mostly find this book too informal (see the index entry for “stickler alert”). We have focused on perspicuous explanations and intuition, and sometimes we have done this at the expense of rigor. Our aim is to simplify, but not to oversimplify. We lead readers to the goal through a path that avoids the trolls and dragons, so why begin the journey by pointing them all out before we've even said what our destination is or why we're going there? However, since we know readers will be crossing the field on their own eventually, after we reach our goal we will turn around to point out where the dangers lie. But we may sometimes need to leave certain troll-slaying to another source, especially if we expect that your usual path won't take you near the danger. Those who intend to be on that land frequently should consult with a local for more intimate knowledge. This is not to say that we think rigor is unimportant; we just think it's easier to get rigor after intuition about the big picture has been established, rather than front-loading every discussion with definitions and axioms needed to handle the edge cases. Frankly, nowadays a reader can pursue concise and formal presentations free on Wikipedia or Wolfram MathWorld, so we don't think any book offers much worth paying for by dwelling excessively on definitions, axioms, proofs, and edge cases, especially for introductory material targeted primarily to engineers.

Unique authors. Our combined experience brings together academic authority with in-the-trenches practical advice. Fletcher Dunn has been making video games professionally since 1996. He worked at Terminal Reality in Dallas, where as principal programmer he was one of the architects of the Infernal engine and lead programmer on BloodRayne. He was a technical director for The Walt Disney Company at Wideload Games in Chicago and the lead programmer for Disney Guilty Party, IGN's E3 2010 Family Game of the Year. He now works for Valve Software in Bellevue, Washington and has contributed to Steam and all of Valve's recent games. He is the primary author of the GameNetworkingSockets networking library and the Steam Datagram Relay service. But his biggest claim to fame by far is as the namesake of Corporal Dunn from Call of Duty: Modern Warfare 2.

Dr. Ian Parberry has more than 35 years of experience in research and teaching in academia. This is his sixth book, his third on game programming. He is currently a tenured full professor in the Department of Computer Science & Engineering at the University of North Texas. He is nationally known as one of the pioneers of game programming in higher education, and has been teaching game programming classes at the University of North Texas continuously since 1993.

Unique writing style. We hope you will enjoy reading this math book (say what?) for two reasons. Most important, we want you to learn from this book, and learning something you are interested in is fun. Secondarily, we want you to enjoy reading this book in the same way that you enjoy reading a work of literature. We have no delusions that we're in the same class as Mark Twain, or that this book is destined to become a classic like, say, The Hitchhikers Guide to the Galaxy. But one can always have aspirations. Honestly, we are just silly people. At the same time, no writing style should stand in the way of the first priority: clear communication of mathematical knowledge about video games.2

What You Should Know before Reading This Book

We have tried to make the book accessible to as wide an audience as possible; no book, however, can go back all the way to first principles. We expect from the reader the following basic mathematical skills:

Some programming knowledge is helpful, but not required. In several places, we give brief code snippets to show how the ideas being discussed get translated into code. (Also certain procedures are just easier to explain in code.) These snippets are extremely basic, well commented, and require only the most rudimentary understanding of C language syntax (which has been copied to several other languages). Most technical artists or level designers should be able to interpret these snippets with ease.

Overview

How to Give Feedback

We calculated the odds that we could write an 800+ page math book free of mistakes. The result was a negative number, which we know can't be right, but is probably pretty close. If you find a bug in this book, or have feedback of any kind, send an email to feedback@gamemath.com or reach out to Fletcher on twitter (@ZPostFacto).

Careful. We don't want to learn from this.
— Bill Watterson (1958–) from Calvin and Hobbes
  1. Well, you may be left out of a few jokes, like that one. Sorry.
  2. Which is why we've put most of the jokes and useless trivia in footnotes like this. Somehow, we felt like we could get away with more that way.
  3. To the exercises, that is.