For those of you who have booked our game engine course, make sure you force yourself to read everything at least once, because these tips will be reflected in the design of the entire game engine.


Ah! I’m pregnant!

The 3D coordinate system is actually a simple extension of the 2D case. Let’s simply add an axis perpendicular to both the x and y axes, let’s call it the z axis. The X-axis points to the right, the Y-axis points up, and the Z-axis points behind us.

Right, for those of you who are learning OpenGL with MOE, this is the legendary right hand coordinate system. We will, of course, according to our most familiar coordinate system to introduce, the books on the market you are don’t understand, because some not right-handed coordinate system, some even are right-handed coordinate system, the data structure is not in accordance with the standard memory to do, so the theory of code is decoupling, but you don’t be afraid, have we, your future will be smooth.

In geometry, the 3D coordinate system defines something very familiar: Euclidean space.


Now it’s time for pure math, not storytelling, so please pull up your pants, wipe your nose, and close the curtains.

The three axes in the 3D coordinate system are called the basis of the coordinate system. A basis is a set of vectors that are linearly independent of each other. Such a set of vectors can represent any vector in the coordinate system by linear combination. A set of linearly independent vectors is a set of vectors that can be represented by linear combinations of other vectors. Changing the basis or changing the coordinate system is the most common operation in computer graphics.


Left handed versus right handed

There are left hand coordinates and right hand coordinates, so if you go to the algorithm book you have to see what the algorithms are in manual coordinates. The left and right coordinate system is shown in the figure below:

As you can see, the coordinates are left hand coordinates, and the right hand coordinates.

Why do we call them left handed and right handed? Might as well take out your jade hand, put the pose in the picture, is not very cool.

So how the hell does a right-handed coordinate system affect how you write code?

Their calculation of the normal orientation is decisive. If you use a right-handed coordinate system, the points of a polygon must be organized counterclockwise to count as the face. Later we will have related articles or content to introduce this part.



Right, Up, Forward

Cartesian coordinates define only three unit vectors that are perpendicular to each other. They don’t really mean anything, so it’s you, and yes, it’s you, the goofy programmer, who decides what they mean geometrically.

In all the courses of the Eastern Han Academy, we use the right hand coordinate system. This is the exact same coordinate system as OpenGL. Other things that use right-handed coordinates like Maya. DirectX, PBRT, and PRMan use left-handed coordinates.


World coordinate system

We now know that the coordinates of points and vectors are relative to the origin of their Cartesian coordinates. We also said that we can create an infinite number of frames, in which points and vectors are unique. So, a lot of 3D programs define the best coordinate system, and all the other coordinate systems are defined relative to this coordinate system, and this guy is called the world coordinate system. This world coordinate system defines the X, y, and Z axes, and everything else is defined by that data. The world coordinate system is probably the most important thing in the entire rendering pipeline. Other coordinate systems include model coordinate, local coordinate, viewport coordinate, and screen coordinate. We’ll talk about it later.


What we need to keep in mind is this

Share and forward. Since the service number can only send four articles in a group every month, students need to come to us for other articles. Starting from April, we will publish an article every day to help students in our game engine line to study more easily and happily.