Looking at the pipeline of games, I am confused about the necessity of homogeneous coordinates.
For gameplay logic, a 4x3 matrix is enough to handle translation, rotation, and scale. I can't think of anything to require a 4th dimension unless we are making a game of theme about universe, blackhole, time, light speed.
For clipping space, homogeneous clip space just does these things to clip out unwanted parts;
\begin{cases}
\text{w>0}\\
\text{|x|<|w|}\\
\text{|y|<|w|}\\
\text{|z|<|w|}\\
\end{cases}
However the w
is the -z
value before the final perspective projection. Without a 4th dimension, I can also clip in this way, and map z to the new z value in z-buffer as is.
\begin{cases}
\text{z<0}\\
\text{|x|<|z|}\\
\text{|y|<|z|}\\
\text{far<z<near}\\
\end{cases}
The perspective devide can also be done by dividing z, so the point on your screen space is
\$(-x/z, -y/z, z)\$
Someone says we can tell if a vector is a direction or a point by using w==0
or w==1
. But when we write shader or game logic, we probably know what is passed to our code and can just call the corresponding transform function.