This page lists, with general expressions, the transformation matrices used in Part 1 (isometric orthographic view) and Part 2 (three classical perspective views), and shows how they are concatenated into the composite matrix applied to every vertex in the vertex shader.
lookAt function)Given eye point \(e\), look-at point \(a\), and up vector \(u\), build the orthonormal eye basis
$$ \vec b_3=\frac{e-a}{\lVert e-a\rVert},\qquad \vec b_1=\frac{u\times\vec b_3}{\lVert u\times\vec b_3\rVert},\qquad \vec b_2=\vec b_3\times\vec b_1 , $$so the view matrix is the change of coordinates \(V=RT\):
$$ V=\operatorname{lookAt}(e,a,u)= \begin{bmatrix} \vec b_1^{\,T} & -\,e\cdot\vec b_1\\ \vec b_2^{\,T} & -\,e\cdot\vec b_2\\ \vec b_3^{\,T} & -\,e\cdot\vec b_3\\ \mathbf 0 & 1 \end{bmatrix}. $$with vertical field of view \(\alpha\) and aspect ratio \(A=w/h\).
The cube already sits in world space with its diagonal from \((0,0,0)\) to \((1,1,1)\), so the model matrix is the identity, \(M=I\). The isometric look comes entirely from the camera: an orthographic projection viewed along the cube's main diagonal,
$$ V=\operatorname{lookAt}\big(e=(2,2,2),\;a=(\tfrac12,\tfrac12,\tfrac12),\;u=(0,1,0)\big),\qquad P=\operatorname{ortho}(-s,s,-s,s,0.1,10),\;\; s=1.2 . $$Composite matrix used in the vertex shader:
$$ \boxed{\,x_{\text{clip,wgpu}} = M_{st}\,P_{\text{ortho}}\,V\,I\;x_{\text{model}}\,} $$All three cubes share one pinhole camera (vertical field of view \(\alpha=45^\circ\)) and one view matrix:
$$ P=\operatorname{perspective}(45^\circ,\,A,\,0.1,\,100),\qquad V=\operatorname{lookAt}\big(e=(0,0,4.5),\;a=(0,0,0),\;u=(0,1,0)\big). $$Each cube is first centred on the origin and shrunk to fit, using the shared placement \(\;P_{\text{lace}} = S(0.9,0.9,0.9)\,T(-\tfrac12,-\tfrac12,-\tfrac12)\). The view type is decided by the model matrix's rotation:
No rotation — the faces stay parallel to the image plane, so only the depth direction has a vanishing point.
$$ M_1 = T(-1.5,0,0)\,S(0.9,0.9,0.9)\,T(-\tfrac12,-\tfrac12,-\tfrac12) $$Rotate about \(y\) only — the vertical edges stay parallel, while the two horizontal edge directions each get a vanishing point.
$$ M_2 = R_y(30^\circ)\,S(0.9,0.9,0.9)\,T(-\tfrac12,-\tfrac12,-\tfrac12) $$Rotate about \(y\) and \(x\) — no edge stays parallel to the image plane, giving three vanishing points.
$$ M_3 = T(1.5,0,0)\,R_x(-20^\circ)\,R_y(-30^\circ)\,S(0.9,0.9,0.9)\,T(-\tfrac12,-\tfrac12,-\tfrac12) $$Composite matrix used in the vertex shader for cube \(i\):
$$ \boxed{\,x_{\text{clip,wgpu}} = M_{st}\,P_{\text{persp}}\,V\,M_i\;x_{\text{model}},\qquad i=1,2,3\,} $$