Mathematics for Game Programming and Computer Graphics: Explore the essential mathematics for creating, rendering, and manipulating 3D virtual environments
- Length: 444 pages
- Edition: 1
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2022-11-30
- ISBN-10: 1801077339
- ISBN-13: 9781801077330
- Sales Rank: #8853743 (See Top 100 Books)
A comprehensive guide to learning fundamental 3D mathematical principles used in games and computer graphics by example
Key Features
- Get acquainted with the essential mathematics needed to describe, simulate, and render 3D creations
- Construct and manipulate 3D animated environments using Python, Pygame, and PyOpenGL
- Develop vertex and fragment shaders in OpenGL shader language to speed up rendering
Book Description
Mathematics is an essential skill when it comes to graphics and game development, particularly if you want to understand the generation of real-time computer graphics and the manipulation of objects and environments in a detailed way. Python, together with Pygame and PyOpenGL, provides you with the opportunity to explore these features under the hood, revealing how computers generate and manipulate 3D environments.
Mathematics for Game Programming and Computer Graphics is an exhaustive guide to getting “back to the basics” of mathematics, using a series of problem-based, practical exercises to explore ideas around drawing graphic lines and shapes, applying vectors and vertices, constructing and rendering meshes, and working with vertex shaders. By leveraging Python, Pygame, and PyOpenGL, you’ll be able to create your own mathematics-based engine and API that will be used throughout to build applications.
By the end of this graphics focussed book, you’ll have gained a thorough understanding of how essential mathematics is for creating, rendering, and manipulating 3D virtual environments and know the secrets behind today’s top graphics and game engines.
What you will learn
- Get up and running with Python, Pycharm, Pygame, and PyOpenGL
- Experiment with different graphics API drawing commands
- Review basic trigonometry and how it’s important in 3D environments
- Apply vectors and matrices to move, orient, and scale 3D objects
- Render 3D objects with textures, colors, shading, and lighting
- Work with vertex shaders for faster GPU-based rendering
Who this book is for
This book is for programmers who want to enhance their 3D mathematics skills relating to computer graphics and computer games. Knowledge of high school–level mathematics and a working understanding in an object-orientated language is needed to grasp the contents present in this book.
Cover Title Page Copyright and Credits Contributors Table of Contents Preface Part 1 – Essential Tools Chapter 1: Hello Graphics Window: You’re On Your Way Technical requirements Getting Started with Python, PyCharm, and Pygame Creating a Basic Graphics Window Working with Window and Cartesian Coordinates Let’s do it… Your Turn… Summary Answers Chapter 2: Let’s Start Drawing Technical requirements Color Let’s do it… Your turn… Lines Let’s do it… Your turn… Let’s do it… Text Let’s do it… Your turn… Polygons Let’s do it… Your turn… Raster Images Let’s do it… Summary Answers Chapter 3: Line Plotting Pixel by Pixel Technical requirements The Naïve Way: Drawing a line with brute force Let’s do it… Enter Bresenham: The improved approach Let’s do it… Drawing circles the Bresenham way Let’s do it… Anti-aliasing Summary Chapter 4: Graphics and Game Engine Components Technical requirements Exploring the OpenGL Graphics Pipeline Let’s do it… Drawing Models with Meshes Let’s do it… Your turn… Viewing the Scene with Cameras Projecting Pixels onto the Screen Understanding 3D Coordinate Systems in OpenGL Perspective Projection Your turn… Projecting into the NDC Let’s do it… Your turn… Summary Answers Chapter 5: Let’s Light It Up! Technical requirements Adding Lighting Effects Let’s do it… Your turn… Placing Textures on Meshes Let’s do it… Let’s do it… Summary Answers Chapter 6: Updating and Drawing the Graphics Environment Technical requirements Introducing the main game loop Updating and drawing objects Let’s do it… Your turn… Measuring time Let’s do it… Summary Answers Chapter 7: Interactions with the Keyboard and Mouse for Dynamic Graphics Programs Technical requirements Working with mouse interactions Let’s do it… Your turn… Combining 2D and 3D environments Let’s do it… Converting the mouse to projection coordinates Let’s do it… Your turn… Let’s do it… Adding keyboard commands Let’s do it… Your turn… Let’s do it… Summary Answers Part 2 – Essential Trigonometry Chapter 8: Reviewing Our Knowledge of Triangles Technical requirements Comparing similar triangles Working with right-angled triangles Your turn… Calculating angles with sine, cosine, and tangent Investigating triangles by drawing 3D objects Summary Answers Chapter 9: Practicing Vector Essentials Technical requirements Understanding the difference between points and vectors Defining vector key operations Let’s do it… Working out a vector’s magnitude Your turn… Exploring the relationship between angles and vectors The dot product The cross product Summary Answers Chapter 10: Getting Acquainted with Lines, Rays, and Normals Technical requirements Defining lines, segments, and rays Using the parametric form of lines Your turn… Let’s do it… Calculating and displaying normals Your turn… Let’s do it… Your turn… Summary Answers Chapter 11: Manipulating the Light and Texture of Triangles Technical requirements Displaying Mesh Triangle Normals Let’s do it… Defining polygon sides with normals Working with visible sides of a polygon Culling Polygons According to the Normals Let’s do it… Let’s do it… Exploring How Normals Affect Lighting Let’s do it… Summary Part 3 – Essential Transformations Chapter 12: Mastering Affine Transformations Technical requirements Translating points in 3D Your turn… Scaling points with x, y, and z Let’s do it… Your turn… Rotating points around a pivot Let’s do it… Exploring transformation orders Shearing and reflections Summary Answers Chapter 13: Understanding the Importance of Matrices Technical requirements Defining matrices Performing operations on matrices Adding and subtracting matrices Multiplying by a single value Dividing matrices Creating matrix representations of affine transformations Moving from linear equations to matrix operations Compounding affine transformations Combining transformation matrices for complex maneuvers Let’s do it… Summary Answers Chapter 14: Working with Coordinate Spaces Technical requirements Understanding OpenGL’s Matrix Stack Working with the Model Matrix Let’s do it… Your turn… Working with the View Matrix Let’s do it… Working with the Projection Matrix Let’s do it… Your turn… Summary Answers Chapter 15: Navigating the View Space Technical requirements Flying maneuvers Let’s do it… Your turn... Understanding and fixing compound rotation quirks Improving camera orientations Let’s do it… Summary Answers Chapter 16: Rotating with Quaternions Technical requirements Introducing quaternions Rotating around an arbitrary axis Exploring quaternion spaces Let’s do it… Working with unit quaternions Your turn… Understanding the purpose of normalization Let’s do it... Your turn... Summary Answers Part 4 – Essential Rendering Techniques Chapter 17: Vertex and Fragment Shading Technical requirements Understanding shaders Transferring processing from the CPU to the GPU Let’s do it… Processing pixel by pixel Let’s do it… Summary Chapter 18: Customizing the Render Pipeline Technical requirements Coloring and texturing mesh faces Let’s do it… Let’s do it… Your turn... Turning on the lights Ambient lighting Diffuse lighting Phong Summary Answers Chapter 19: Rendering Visual Realism Like a Pro Technical requirements Following where light bounces Applying the Inverse Square Law Calculating Bidirectional Reflectance Distribution functions The Fresnel effect Geometric attentuation factor Putting it all together Let’s do it… Summary Index Other Books You May Enjoy
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: Mathematics for Game Programming and Computer Graphics: Explore the essential mathematics for creating, rendering, and manipulating 3D virtual environments
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.