You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above matrix transforms the vertex $(x_i, y_i, z_i, 1)$ in 3D (4D) coordinate space to clip space $(-1 \leq x_f, y_f, z_f \leq 1)$. Moreover, the "normalization" factor $w$ (aka the fourth dimension of the vertex) becomes $\frac{z_i}{nearZ} + 0.0001$. The 0.0001 is to avoid dividing the vertex by zero in case $z = 0$ since WebGL automatically divides the vertex by $w$ to "normalize" it.
Recommended coordinate system
$(0,0)$ at the top left corner of the screen. $+x$ to the right, $+y$ to the bottom, and $+z$ into the screen.