Chapter 4. Math for 3D Graphics (Mathematics in 3D graphics)

Monday to Friday, a day, 7 am Beijing time on time updates -

What You'll Learn in This Chapter (chapter you will learn what)

What a vector is, and why you should care about them ( what is a vector and why you need to pay attention to them)
the What A the Matrix IS, and Why you Should Care More the About Them (what is the matrix and why you need to pay more attention to them)
How WE use matrices and vectors to move geometry around ( how we use the matrices and vectors to move geometric objects)
what Conventions the OpenGL and coordinate spaces are (converted coordinate space and is valid in OpenGL)
So far, you have learned to draw points, lines, and triangles and have written simple shaders that pass your hard-coded vertex data through unmodified (Now that you've learned how to draw points, lines and triangles, and we wrote some simple shader, they do not modify the data, merely played a role in the transfer of data in a graphics pipeline). we have not really been rendering in 3D-which is odd for a book on 3D graphics! (we have not really 3D rendering of things, it's not strange for a book 3D graphics for you) Well, to turn a collection of shapes into a coherent scene, you must arrange them in relation to one another and to the viewer (however, structured to organize objects in the 3D scene, you have to manage the relative relationship between them and the relationship and cameras). in this chapter, you start moving shapes and objects around in your coordinate system (in this section, you will begin moving objects in your coordinate system). the ability to place and orient your objects in a scene is a crucial tool for any 3D graphics programmer (for 3D programmers the ability to place and rotation of the object in the scene is crucial). As you will see,

Is This the Dreaded Math Chapter? (This is a dog with math section of it)

. In most books on 3D graphics programming, yes, this would be the dreaded math chapter (in most 3D graphics in books, indeed, this is the mathematical content of a chapter leash) However, you can relax; we take a more moderate approach to these principles than some texts (however, you can relax, we will use some of the more comfortable means to explain these principles rather than against the text description)

One of the fundamental mathematical operations that will be performed by your shaders is the coordinate transform, which boils down to multiplying matrices with vectors and with each other (the basic mathematical operations in a shader that you will use in the coordinate system conversion, it relates to matrix-matrix multiplication of the vector and matrix). the keys to object and coordinate transformations are two matrix conventions used by OpenGL programmers (for OpenGL programmers, the key lies in two coordinate transformation matrix). to familiarize you with these matrices, this chapter strikes a compromise between two extremes in computer graphics philosophy (in order to familiarize you with these matrices, this section will use this scheme two extreme ideas in computer graphics to explain). On the one hand, we could warn you, "Please review a textbook on linear algebra before reading this chapter." (on the one hand, we will warn you that before you read this chapter, first look at the book of linear algebra) on the other hand, we coul d perpetuate the deceptive reassurance that you can "learn to do 3D graphics without all those complex mathematical formulas.

In reality, you can get along just fine without understanding the finer mathematics of 3D graphics, just as you can drive your car every day without having to know anything at all about automotive mechanics and the internal combustion engine (in fact, you do not have to be in in the case of 3D math proficiency, well deal with 3D programming problems, just like you do not know what the principles of automobile production and engine will be able to drive the same). But you had better know enough about your car to realize that you need an oil change every so often, that you have to fill the tank with gas regularly, and that you must change the tires when they get bald (but you'd better know more about your car, so you can know when to refuel and when to cheer up). this knowledge makes you a responsible (and safe!) automobile owner (this knowledge allows you to better Fun your car). If you want to be a responsible and capable OpenGL programmer, the same standards apply (if you want to become a stronger drive OpenGL Member, is the same reason).

So even if you do not already have the ability to multiply two matrices in your head, you need to know what matrices are and how they serve as the means to OpenGL's 3D magic (So, even if you do not know how to calculate the matrix multiplication, you need to know what is the matrix, as well as their significance in OpenGL). (but before but before you go dusting off that old linear algebra textbook (does not everyone have one?) you begin to turn your linear algebra textbook again Do not be afraid: because our sb7 library which should include a component called vmath, it can very well help you solve the problem of computing mathematics), have no fear: the sb7 library has a component called vmath that contains a number of useful classes and functions that can be used to represent and manipulate vectors and matrices. they can be used directly with OpenGL and are very similar in syntax and appearance to GLSL-the language you'll be writing your shaders in (they can be like you Like using a matrix that will be used in the shader way). So, you do not h ave to do all your matrix and vector manipulation yourself,

Translations of this day to get here, see you tomorrow, bye ~

Get the latest plot first time, please pay attention to the Eastern Han Dynasty academy and the heart of the public graphic No.

Han College, waiting for you to play Oh

Guess you like

Origin blog.51cto.com/battlefire/2424395