When dealing with 3d we've got a coordinate system is three directions. And using Web GL, which is what three GS has, as its basis, we find the coordinates are y going upwards. Increasing increase is going up which x increases to the right, and Zed increases out out of the screen. That's assuming that the camera is pointing directly down to the Zed axis. We put some numbers to this. I add in a grid, we can define a point, an individual point where its position is five along the x axis for up the wire Access on three along these access, so we can define that point, x is five, y is four, Zed is three, if we introduce two more points, so that's our original point.
And now we have a point over here where x is zero, y is four, and that is zero points over here where x is five, y is four, and Zed is still zero. And we can introduce a triangle defined by those three points, often referred to as vertices. We can take the idea of a single triangle and extend it out. So now we have a cube here, where we have eight vertices and we have seemingly six sides to this, but each side is going to be two triangles, there will be 12 triangles in total. If we if we number the vertices v one v two v three, V four, etc. Then we can define the triangle as v one v two v three.
And the other part of this top face will be v one v three v four. In order to create lighting calculations, we have something that sticks out to every one of our triangles, and often every one of our vertices and this is a normal a normal life. To calculate the direction that lights coming in, and use this normal to calculate the values as a color should be for each pixel in our rendered screen. So we get to the ability to be able to create a rotating cube, which we'll look at doing in the next section. If we convert that to wireframe, you can see that the cube is actually made up of triangles. So at its heart, everything we ever render will be a triangle.
The rotation of this and the position this is all calculated using matrices. Well, thankfully, you won't have to worry about that low level of mathematics. When you're using the three GS library. It makes it much simpler than that.