Eric Lengyel, Ph.D.

Founder, President, and Chief Technology Officer
Terathon Software LLC

Eric Lengyel (pronounced LENG · el, with no Y) is the founder of Terathon Software. He holds a Ph.D. in Computer Science from the University of California, Davis, and a Masters Degree in Mathematics from Virginia Tech.

Eric is the creator of the following technologies:

Eric is the author of the new book series Foundations of Game Engine Development, and he is the editor for the Game Engine Gems series. Almost 20 years ago, he wrote the first book focused on mathematics in games, the best-selling Mathematics for 3D Game Programming & Computer Graphics. Eric has also been a long-time member of the editorial board for the Journal of Computer Graphics Techniques, and he has been a major contributor to the successful Game Programming Gems series.

Eric is an active researcher in the field of projective geometric algebra. The educational resources that he has created for this subject can be found on

Eric previously worked in the advanced technology group at Naughty Dog and the graphics and imaging department at Apple. Before those, he was the lead programmer for the fifth installment of Sierra Studio's popular RPG adventure series Quest for Glory. When he's not at his desk, Eric can usually be found running somewhere in the mountains of northern California.

Eric Lengyel

Books and Book Chapters

Foundations of Game Engine Development, Volume 1: Mathematics
Terathon Software, 2016.
ISBN: 978-0985811747

Book site:
The first volume of Foundations of Game Engine Development discusses the mathematics needed by engineers who work on games or other types of virtual simulations. The book begins with conventional treatments of topics such as linear algebra, transforms, and geometry. Then, it introduces Grassmann algebra and geometric algebra to provide a much deeper understanding of the subject matter and highlight the places where traditional arithmetic with vectors, matrices, quaternions, etc., isn't quite correct.
Game Engine Gems 1
Motion Blur and the
Velocity-Depth-Gradient Buffer
Game Engine Gems 1, Jones and Bartlett, 2010.
ISBN: 978-0763778880

Book site:
Motion blur can be simulated using a velocity buffer in conjunction with a post-processing shader to render a directional blur for pixels belonging to moving objects. A basic implementation of this technique produces adequate results for some applications, but it also produces a fuzzy halo artifact. This gem discusses an improvement to this motion blur technique that eliminates halo artifacts without also affecting cases where motion blur would be correctly rendered, producing images of much higher quality than is possible with previous techniques.
Moments of Inertia for Common Shapes
Game Engine Gems 1, Jones and Bartlett, 2010.
ISBN: 978-0763778880

Book site:
Instead of laboriously evaluating a complicated integral to derive the moment of inertia for a particular shape, one may choose to look it up, but existing references can be difficult to find, and those that do exist are sometimes inaccurate or incomplete. This gem provides the derivations of the moments of inertia for a variety of common shapes and summarizes them in a handy reference table.
Foundations of Game Engine Development, Volume 2: Rendering
Terathon Software, 2019.
ISBN: 978-0985811754

Book site:
The second volume in the Foundations of Game Engine Development series explores the vast subject of real-time rendering in modern game engines. The book provides a detailed introduction to color science, world structure, projections, shading, light sources, shadows, fog, and visibility methods. This is followed by extensive discussions of a variety of advanced rendering techniques that include volumetric effects, atmospheric shadowing, ambient occlusion, motion blur, and isosurface extraction. Emphasis is placed on practical implementation, and code is included.
Game Engine Gems 2
A Jitter-Tolerant Rigid Body Sleep Condition
Game Engine Gems 2, A K Peters, 2011.
ISBN: 978-1568814377

Book site:
All physics engines exhibit some jitter no matter how good the constraint solver is. This chapter discusses a simple condition that can be used to determine when it is the proper time to put a rigid body to sleep, and it is highly tolerant to jitter.
Bit Hacks for Games
Game Engine Gems 2, A K Peters, 2011.
ISBN: 978-1568814377

Book site:
Game programmers have long been known for coming up with clever tricks that allow various short calculations to be performed more efficiently. The techniques usually employ some kind of logical bit manipulation, or “bit twiddling”, to obtain a result in a roundabout way with the goal of reducing the number of instructions, eliminating expensive instructions like divisions, or removing costly branches. This chapter describes a variety of interesting bit hacks that are likely to be applicable to game engine codebases.
Mathematics for 3D Game Programming and Computer Graphics
Cengage Learning, 2011.
ISBN: 978-1435458864

Book site:
This book, now used as a text in computer graphics courses at many universities around the world, illustrates the mathematics that a programmer would need to develop a professional-quality 3D engine. Although the book is geared toward applications in game development, many of the topics appeal to general interests in 3D graphics. It starts at a fairly basic level in areas such as vector geometry and linear algebra, and then progresses to more advanced topics in 3D game programming such as illumination, visibility determination, and collision detection. Particular attention is given to derivations of key results, ensuring that the reader is not forced to endure gaps in the theory. The book assumes a working knowledge of trigonometry and calculus, but also includes sections that review the important tools used from these disciplines, such as trigonometric identities, differential equations, and Taylor series.
Game Engine Gems 3
The Open Game Engine Exchange Format
Game Engine Gems 3, A K Peters, 2016.
ISBN: 978-1498755658

Book site:
This chapter provides a comprehensive overview of the OpenGEX file format.
Fog with a Linear Density Function
Game Engine Gems 3, A K Peters, 2016.
ISBN: 978-1498755658

Book site:
The chapter discusses the mathematical details about rendering techniques and visibility culling for halfspace fog with a linear density function.
Smooth Horizon Mapping
Game Engine Gems 3, A K Peters, 2016.
ISBN: 978-1498755658

Book site:
The chapter describes a high-quality horizon mapping technique for applying soft shadows to normal-mapped surfaces.
Introduction to Game Development
Mathematical Concepts
Mathematics has become an essential component of modern game development. As both the main processors and graphics processors in our gaming hardware become more powerful, the complexity of the mathematics used to model realistic environments and physical simulations increases without bound. This chapter provides an introduction to several fields of mathematics that are vital to today's game engines.

Trigonometry is a ubiquitous tool used extensively by game programmers and serves as this chapter's opening topic and prerequisite for the indisputably important topic of linear algebra. The bulk of this chapter discusses vectors and matrices, the indispensable tools of linear algebra with which every 3D game developer needs to be familiar. We also introduce mathematical representations of geometrical entities, such as lines and planes, and describe how to perform certain routine calculations with them.
Open Game Engine Exchange Specification
Terathon Software, 2017.
ISBN: 978-0985811792

The Open Game Engine Exchange (OpenGEX) format is a text-based file format designed to facilitate the transfer of complex scene data between applications such as modeling tools and game engines. The OpenGEX format is built upon the data structure concepts defined by the Open Data Description Language (OpenDDL), a generic language for the storage of arbitrary data in human-readable format. This specification provides a description of the data structures defined by OpenGEX, and it includes an OpenDDL reference as an appendix.
Game Programming Gems 1
Tweaking a Vertex's Projected Depth Value
Game Programming Gems, Charles River Media, 2000.
The goal of this article is to find a way to offset a polygon's depth in a scene without changing its projected screen coordinates or altering its texture mapping perspective. Most 3D graphics libraries contain some kind of polygon offset function to help achieve this goal. However, these solutions generally lack fine control and usually incur a per-vertex performance cost. This gem presents an alternative method which modifies the projection matrix to achieve the depth offset effect.
A Fast Cylinder-Frustum Intersection Test
Game Programming Gems, Charles River Media, 2000.
Before attempting to render a complex object, many games first determine whether a geometrically simple volume bounding that object is visible. Due to their computational efficiency, spheres and boxes are commonly used as bounding volumes, but it is sometimes the case that objects are naturally suited to be bounded by a cylinder. Although we will not be able to achieve the speed at which a sphere or box could be tested, this gem presents a quick algorithm for determining whether an arbitrary cylinder potentially intersects the view frustum (and thus whether it is visible).
Game Programming Gems 5
Oblique View Frustums for
Mirrors and Portals
Game Programming Gems 5, Charles River Media, 2005.
Techniques for rendering mirrors and portals displaying a remote part of the scene require that an extra clipping plane be used to prevent geometry seen in the mirror or portal from crossing into the local scene. This gem discusses a technique that modifies the projection matrix in such a way that the conventional near plane of the view frustum is repositioned to serve as the generally oblique boundary clipping plane.
Game Programming Gems 2
Applying Decals to Arbitrary Surfaces
Game Programming Gems 2, Charles River Media, 2001.
Many games need to render special effects such as scorch marks on a wall or footprints on the ground that are not an original part of a scene, but are created during gameplay. These effects are commonly implemented by creating a new object, which we will call a decal, that coincides with an existing surface and rendering it using some kind of depth offset technique. Applying a decal to the interior of a planar surface is simple, but difficulties arise when applying decals to the more complex surfaces used in today's games to represent curved objects and terrain patches. This article presents a general method for applying a decal to an arbitrarily shaped surface and concurrently clipping the decal to the surface's boundary.
The OpenGL Extensions Guide
Charles River Media, 2003.
ISBN: 1-58450-294-0
This book once provided a much needed resource and concentrates specifically on 78 of the extensions most important to developing modern 3D games. The book is laid out in an intuitive fashion, discussing groups of extensions that modify or augment similar components of the base OpenGL architecture. In addition, the text focuses mainly on operational and implementation issues, discussing the underlying mathematics of an extension only when it is critical to understanding that extension's functionality.
Game Programming Gems 3 The Best of Game Programming Gems
T-Junction Elimination and Retriangulation
Game Programming Gems 3, Charles River Media, 2002.
This gem describes how to detect possible sources of seams in complex 3D scenes and how to modify static geometry so that visible artifacts are avoided. Since T-junction elimination adds vertices to existing polygons (that are not necessarily convex), this article also discusses a method for triangulating arbitrary concave polygons.

Also published in Best of Game Programming Gems, 2008.

Conference Slides

i3D Symposium 2018
i3D Symposium 2018.
This talk is a presentation of the paper with the same title. It describes a method for rendering antialiased text directly from glyph outline data on the GPU without the use of any precomputed texture images or distance fields.
Game Developers Conference 2021
Game Developers Conference 2021.
This talk reviews Grassmann algebra and discusses new developments in projective geometric algebra, including the geometric antiproduct, homogeneous magnitudes, proper isometries (motors), and improper isometries (flectors).
Game Developers Conference 2015
Game Developers Conference 2015.
As part of the day-long mathematics tutorial, this presentation examines a grab-bag of real-world mathematical problems that arose in shipping game products and discusses what strategies were used to find elegant solutions. Also includes a variety of mathematical tricks and bit manipulation tricks.
Game Developers Conference 2018
Game Developers Conference 2018.
As part of the day-long mathematics tutorial, this presentation discusses the implementation of C++ vector-matrix libraries with focus on mathematical correctness and syntactic conveniences. Includes methods for using swizzle notation for vectors in C++ and extending the same concept to matrices for things like zero-cost transpose.
WSCG Keynote 2012.
This talk introduces the basic concepts of the exterior algebra and presents a bigger mathematical picture that enables a deeper understanding of the homogeneous representation of points, lines, and planes, as well as the operations that can be performed among them using the progressive and regressive products.
Game Developers Conference 2014
Game Developers Conference 2014.
As part of the day-long mathematics tutorial, this presentation introduces Grassmann algebra and describes how it can be used in game development. The talk discusses topics such as the wedge product, bivectors, and geometric computation in homogeneous coordinates.
Game Developers Conference 2007
Game Developers Conference 2007.
This presentation examines the inner workings of the perspective projection matrix and discusses several techniques for modifying the properties of the projection matrix to solve specific rendering problems at zero cost.
Game Developers Conference 2012
Game Developers Conference 2012.
This presentation provides a thorough introduction to the basic geometric properties of the wedge product and multivectors as they would be used in game development. Particular focus is given to the geometric manipulation of points, lines, and planes in generalized homogeneous coordinates.
Game Developers Conference 2005
Game Developers Conference 2005.
This presentation reviews advanced implementation techniques of the stencil shadow algorithm and focuses on the relatively new method of penumbral wedge rendering used to generate soft-edged shadows.
Game Developers Conference 2006
Game Developers Conference 2006.
This presentation focuses primarily on portal systems and describes algorithms and optimizations that can be applied to a graphics engine supporting completely dynamic lighting and shadows.

Journal Papers and Magazine Articles

Journal of Computer Graphics Techniques
Journal of Computer Graphics Techniques,
Vol. 6, No. 2 (2017).
This paper describes a method for rendering antialiased text directly from glyph outline data on the GPU without the use of any precomputed texture images or distance fields. This capability is valuable for text displayed inside a 3D scene because, in addition to a perspective projection, the transform applied to the text is constantly changing with a dynamic camera view. Our method overcomes numerical precision problems that produced artifacts in previously published techniques and promotes high GPU utilization with an implementation that naturally avoids divergent branching.
Journal of Graphics Tools
Unified Distance Formulas for
Halfspace Fog
Journal of Graphics Tools, Vol. 12, No. 2 (2007).
DOI: 10.1080/2151237X.2007.10129239
In many rendering simulations, it is necessary to model a fog volume that is bounded by a single plane but is otherwise infinite in extent. In such cases, the partial distance within the fog volume through which light travels between a surface point and the camera must be determined for each pixel rendered. This paper presents unified formulas that provide the correct distance traveled through a fog halfspace for all surface points and camera positions, effectively removing the need to code for multiple cases separately. One formula is derived for a volume having a constant fog density, and a second formula is derived for a volume having a fog density that increases linearly with distance from the bounding plane.
Journal of Graphics, GPU, and Game Tools
Transition Cells for Dynamic
Multiresolution Marching Cubes
Journal of Graphics, GPU, and Game Tools,
Vol. 15, No. 2 (2010).
DOI: 10.1080/2151237X.2011.563682
This paper presents a method for quickly and seamlessly stitching together triangle meshes generated from multiresolution voxel data with the marching cubes algorithm. A layer of “transition cells” is inserted between volumes of differing voxel resolutions, and triangles are generated for these cells using a new algorithm that is based on a concept similar to marching cubes, but operates on voxel data at two different resolutions. To enable high performance for dynamically changing voxel data, our stitching algorithm requires access only to local data in the voxel map.
Journal of Graphics Tools
On Faster Sphere-Box Overlap Testing
(with Thomas Larsson and Tomas Akenine-Möller)
Journal of Graphics Tools, Vol. 12, No. 1 (2007).
DOI: 10.1080/2151237X.2007.10129232
We present faster overlap tests between spheres and either axis-aligned or oriented boxes. By utilizing quick rejection tests, faster execution times are observed compared to previous techniques. In addition, we present alternative vectorized overlap tests which are compared to the sequential algorithms.
Journal of Game Development
Oblique Depth Projection and
View Frustum Clipping
Journal of Game Development, Vol. 1, No. 2 (2005).
Several 3D rendering techniques have been developed in which part of the final image is the result of rendering from a virtual camera whose position in the scene differs from that of the primary camera. In these situations, there is usually a planar surface, such as the reflecting plane of a mirror, that can be considered the physical boundary of the recursively rendered image. In order to avoid artifacts that can arise when rendered geometry penetrates the boundary plane from the perspective of the virtual camera, an additional clipping plane must be added to the standard six-sided view frustum. However, many 3D graphics processors cannot support an extra clipping plane natively, or require that vertex and fragment shaders be augmented to explicitly perform the additional clipping operation.

This paper discusses a technique that modifies the projection matrix in such a way that the conventional near plane of the view frustum is repositioned to serve as the generally oblique boundary clipping plane. Doing so avoids the performance penalty and burden of developing multiple shaders associated with user-defined clipping planes by keeping the total number of clipping planes at six. The near plane is moved without affecting the four side planes, but the conventional far plane is inescapably destroyed. We analyze the affect on the far plane as well as the related impact on depth buffer precision and present a method for constructing the optimal oblique view frustum., October 2002.
The idea of using the stencil buffer to generate shadows has been around for over a decade, but only recently has 3D graphics hardware advanced to the point where using the stencil algorithm on a large scale has become practical. Not long ago, there existed some unsolved problems pertaining to stencil shadows that prevented the algorithm from working correctly under various conditions. Advances have now been made, however, so that stencil shadows can be robustly implemented to handle arbitrarily positioned point lights and infinite directional lights having any desired spatial relationship with the camera. This article presents the intricacies of the entire stencil shadow algorithm and covers every mathematical detail of its efficient implementation.
MacTech Magazine
MacTech Magazine, June 1999.
MacTech Magazine, January 1996.
MacTech Magazine, November 1995.

Past Game Projects

Quest for Glory 5
Yosemite Entertainment / Sierra Studios
Lead programmer, 1996–1998

Dissertation and Masters Thesis

Voxel-Based Terrain for
Real-Time Virtual Simulations
By Eric Lengyel, University of California Davis, 2010.
Hyperreal Structures Arising from
an Infinite Base Logarithm
By Eric Lengyel, Virginia Tech, 1996.


US Patent #10373352
US Patent #8149242

Contact Info

My email address is my last name at this web page's domain. I get a huge amount of email, and I do read every bit of it. Because of the volume of email that I receive, it can sometimes take a while for me to respond.