# How do I convert 3D vertices and faces to 2D shapes?

I'm assuming all the math is done with projection matrices from linear algebra, but I don't yet understand how they work, and haven't found much information on them.

What I'm mainly curious about is how after you convert the 3D stuff to 2D, how do you attribute the vision through a portal (like in game Portal)? How is that math done?

• "rendering pipeline" is the term you are looking for – wondra Dec 13 '15 at 12:15

The transformation of coordinates is done in 3 steps.

1. World Transformation: Vertex coordinates are in relation to the origin of the mesh. To place it inside your world you have a so called world matrix, doing translation, rotation and scaling. Now your vertex coordinates are in world space.

2. View Transformation: In the next step the world space coordinates are transformed to camera space. You must note, that you are not moving the camera around, in fact you move the whole world aroung. This is done by the view matrix and the vertex coordinates are now in camera/view space.

3. Projection Transformation: Finally you project the coordinates from view space to screen Space. This matrix actually converts your 3D coordinates to screen coordinates, where they can be displayed.

As for you question on the portals: I'd guess they just render the screen a second time to a texture from the position of the "target portal". Then they use this texture for drawing the ellipse on the wall.