Hello Caroline, I just want to confirm some detail about this method. I think this is an isosceles triangle of three vertices – the position of eye , upper left vertex and upper right of near plane. Is it right? The purpose of the method is taking every object on near plane to far plane and zoom in appropriately. Would u please tell me whether my idea is true?

I’m not sure what you mean by that. There is no isosceles triangle involved.

The projection method is for applying perspective to your scene.

P 114 of the book’s pdf (or the Projection section of Chapter 4, if you’re using an ePub) has a picture of a frustum. That’s a cut-off pyramid, with the front described by the near plane (smaller), and the back described by the far plane (larger). The top of the pyramid is where the camera (eye) is, but any object between the eye and the near plane is outside of the frustum.

The aim of the projection matrix is to place all your vertices into an NDC (normalised device coordinates) hemicube, but have the far away vertices scaled down comparative to the near vertices.

(Edit: that’s not quite correct. After multiplying by the projection matrix, the points still need to be scaled down to NDC by the divide-by-w section during the fixed section of the pipeline)

If you didn’t apply the projection, objects towards the back of the plane would have the same size as objects at the front, but obviously, you want objects a long way away to be smaller.

This is a video that explains that process visually: Perspective Projection Matrix - YouTube

The parameters to the projection method are
Fov: field of view
near: the distance to the near plane from the eye (never 0, but usually small)
far: the distance to the far plane from the eye
aspect: height of screen / width of screen

This video explains the math, starting at about 15:47 Code-It-Yourself! 3D Graphics Engine Part #1 - Triangles & Projection - YouTube

1 Like