Mathematics for Game Programming and Computer Graphics (eBook)
444 Seiten
Packt Publishing (Verlag)
978-1-80107-749-1 (ISBN)
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.
A comprehensive guide to learning fundamental 3D mathematical principles used in games and computer graphics by exampleKey FeaturesGet acquainted with the essential mathematics needed to describe, simulate, and render 3D creationsConstruct and manipulate 3D animated environments using Python, Pygame, and PyOpenGLDevelop vertex and fragment shaders in OpenGL shader language to speed up renderingBook DescriptionMathematics 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 learnGet up and running with Python, Pycharm, Pygame, and PyOpenGLExperiment with different graphics API drawing commandsReview basic trigonometry and how it s important in 3D environmentsApply vectors and matrices to move, orient, and scale 3D objectsRender 3D objects with textures, colors, shading, and lightingWork with vertex shaders for faster GPU-based renderingWho this book is forThis 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.]]>
Preface
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 more detail. Python, together with Pygame and PyOpenGL, provides the opportunity for today’s developers to explore these features under the hood, revealing how computers generate and manipulate 3D environments.
Mathematics for Game Programming and Computer Graphics is a comprehensive 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, working with vertex shaders, and implementing physics techniques such as collisions and particle emitters. Using Python, Pygame, and PyOpenGL, you will create your own mathematical-based engine and API that will be used throughout to build applications and examples.
By the end of this book, you will have a thorough understanding of how essential mathematics is to creating, rendering, and manipulating 3D virtual environments and know the secrets behind today’s top graphics and game engines.
When Packt first approached me to write this book, I had just released a course on computer graphics using Python and OpenGL in Udemy and on H3DLearn.com. The timing was never better than to review what I had learned in the course and write it up in a book focused on the mathematics involved.
Mathematics is one of those topics you either love, loathe, or have a quiet appreciation for. I was in the loathe camp for most of my university studies. I found it irritating and a time-consuming function I needed to get done to continue with my love of programming. Then, in my honors (fourth year), I was introduced to computer graphics and fractals. It was like a veil had been lifted for me and mathematics became magical, fascinating, and most importantly, visual. Being able to see the beauty in mathematics changed everything. I’m still not a lover of mathematics, but I’ve definitely gone from the loathe stage to quiet appreciation. Though I guess writing a book about it takes me from just appreciating it to love. You can’t program any computer games or graphics without knowing the mathematics driving it all.
My goal in writing this book is to bring you into the “quiet appreciation” category. If you get to the “love” category, then great! I do believe that we all have different talents. Mathematics is not mine. I do find it quite challenging, but I have persevered and, over my career, learned to understand its origin and application. I am in no way one of those people who can multiply tens of numbers in my head, but I don’t need to be. The point is that if you learn when and where to apply the mathematics, and then transform that into a programming algorithm, and you can validate and be confident of the output, then it doesn’t matter whether you can calculate the output in your head or need time to work it out.
There’s just so much mathematics to cover in this area that I could have honestly written another several hundred pages. However, it’s my hope that the content herein will fire you up and give you the confidence and critical skills to independently further your education.
Who this book is for
This book is for programmers who want to better their 3D mathematics skills relating to computer graphics and computer games. Knowledge of high-school-level mathematics and a working understanding of an object-orientated language will be required.
What this book covers
Chapter 1, Hello Graphics Window: You’re On Your Way, introduces the software tools used throughout the book to explore 3D graphics and game development, where Python and OpenGL will be used to develop graphical window applications.
Chapter 2, Let’s Start Drawing, takes you through a series of exercises to set up and explore the basic skeleton code required to run and update a graphics application.
Chapter 3, Line Plotting Pixel by Pixel, contains a series of exercises to explore low-level line drawing algorithms, beginning with a naive approach that will reveal the issues involved in drawing lines on a raster display.
Chapter 4, Graphics and Game Engine Components, investigates the software architecture of games and graphics engines the associated data structures for working with 3D environments.
Chapter 5, Let’s Light It Up!, shows you how to bring light and texture to a virtual scene to develop solid models of previously used meshes.
Chapter 6, Updating and Drawing the Graphics Environment, takes you through a series of exercises designed to reveal the cyclical nature of producing graphics frames in addition to building a strong foundation for your graphics project.
Chapter 7, Interactions with the Keyboard and Mouse for Dynamic Graphics Programs, teaches you how to use the Pygame API to gather user input via the mouse and keyboard and use it to interact with a game environment.
Chapter 8, Reviewing Our Knowledge of Triangles, reviews trigonometry with an aim to solidify the concepts of similar triangles and the mathematical properties of right-angle triangles.
Chapter 9, Practicing Vector Essentials, investigates the mathematical principles of vectors and explores the link between their properties and right-angle triangles to reveal the many ways they are useful in graphics.
Chapter 10, Getting Acquainted with Lines, Rays, and Normals, explores the similarities and differences between straight geometric elements and applies them to object movement.
Chapter 11, Manipulating the Light and Texture of Triangles, investigates the use of normal vectors in computer graphics and discovers how they are essential for representing, drawing, and lighting 3D models.
Chapter 12, Mastering Affine Transformations, reveals the primary set of operations that allows 3D points and models to be translated, scaled, and rotated in 3D space.
Chapter 13, Understanding the Importance of Matrices, discusses how transformations are represented as matrices and the power this brings to processing computer graphics.
Chapter 14, Working with Coordinate Spaces, teaches you about the different coordinate spaces a vertex is transformed through to get from its local coordinate system to a pixel on the screen.
Chapter 15, Navigating the View Space, guides you to explore ways to move the camera around in a 3D environment as well as discover some glitches in the matrix operations for rotations.
Chapter 16, Rotating with Quaternions, takes you deeper into the highly complex domain of quaternion rotations and shows how 4D spaces can solve 3D rotational issues.
Chapter 17, Vertex and Fragment Shading, guides you through the programming of shader code for the drawing of objects that transfers graphics from CPU control to be processed in parallel on the graphics card.
Chapter 18, Customizing the Render Pipeline, explores some fundamental techniques used to write shader code for elementary shaders that produce lighting effects.
Chapter 19, Rendering Visual Realism Like a Pro, reveals how light physically interacts with a 3D environment and the objects within it to develop a modern physically based rendering shader.
To get the most out of this book
The scripting language used in this book is Python. You should be familiar with coding in Python or at the very least have a working knowledge of an object-orientated programming language, such as C# or C++. Later in the book, when the OpenGL Shader Language is introduced, skills in this area are not required. Though an understanding of how procedural languages, such as C, are formatted would be beneficial. The projects created herein have been tested in the macOS and Windows environments.
| Software covered in the book | Operating system requirements |
| Python | Windows or macOS |
| Pygame | Windows or macOS |
| PyOpenGL | Windows or macOS |
| PyCharm | Windows or macOS |
| OpenGL Shader Language (GLSL) | Windows or macOS |
The downloading and setup instructions for this list of software are covered in the book as they are required.
If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help...
| Erscheint lt. Verlag | 30.11.2022 |
|---|---|
| Sprache | englisch |
| Themenwelt | Mathematik / Informatik ► Informatik ► Grafik / Design |
| Informatik ► Software Entwicklung ► Spieleprogrammierung | |
| Informatik ► Theorie / Studium ► Algorithmen | |
| ISBN-10 | 1-80107-749-5 / 1801077495 |
| ISBN-13 | 978-1-80107-749-1 / 9781801077491 |
| Informationen gemäß Produktsicherheitsverordnung (GPSR) | |
| Haben Sie eine Frage zum Produkt? |
Digital Rights Management: ohne DRM
Dieses eBook enthält kein DRM oder Kopierschutz. Eine Weitergabe an Dritte ist jedoch rechtlich nicht zulässig, weil Sie beim Kauf nur die Rechte an der persönlichen Nutzung erwerben.
Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belletristik und Sachbüchern. Der Fließtext wird dynamisch an die Display- und Schriftgröße angepasst. Auch für mobile Lesegeräte ist EPUB daher gut geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür die kostenlose Software Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür eine kostenlose App.
Geräteliste und zusätzliche Hinweise
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich