Search code examples
mathmatrixvector3dprojection

Division in Projection Matrices


Disclaimer: This question is not the same question as other projection matrix questions.

So Projection Matrices are 4x4 Matrices that are multiplied with 4D vectors to flatten them onto a 2D plane. Like this one:

1 0 0 0
0 1 0 0
0 0 0 0
0 0 1 0

But in the explanation, it says that the x and y coordinates of the vector are divided by Z. But I don't understand how this works because each part of the matrix that is multiplied by Z is 0. A comment in another question on this subject said, "The hardware does this for you." And I didn't quite get what it meant by that. Thank you in advance!


Solution

  • I was confounded by this nomenclature issue, too. Here is a bit better explanation in regards to Vulkan: https://matthewwellings.com/blog/the-new-vulkan-coordinate-system/

    After the programmable vertex stage a set of fixed function vertex operations are run. During this process your homogeneous coordinates in clip space are divided by wc

    Clearly, calling those matrices projection matrices is very misleading if the actual perspective correction isn't actually done by them. :)