Perspective space : Allows perspective projection expressed as matrix.
Common constraints (in OpenGL)
- - Wrap the viewing volume (truncated cone with rectangular basis called frustum) (\(z_{near}, z_{far}, \theta)\) to a cube.
-
- - \(\theta\): view angle
- - \(p=(x,y,z,1)\in\) frustum \(\Rightarrow p'=(x',y',z',1) \in [-1,1]^3\).
\[ \small \mathrm{M} = \left( \begin{array}{cccc} f & 0 & 0 & 0 \\ 0 & f & 0 & 0 \\ 0 & 0 & C & D \\ 0 & 0 & -1 & 0 \end{array} \right) \;\;\;
\begin{array}{l} f = 1/\tan(\theta/2) \\ L = z_{near}-z_{far} \\ C = (z_{far}+z_{near})/L \\ D = 2 \, z_{far} \, z_{near}/L \\ \end{array} \]
In practice
- => You must define \(z_{near}\), \(z_{far}\)
- => \(z_{far}-z_{near}\) should be as small as possible for maximum depth precision.
\(\color{blue}{\theta}\)
To which view space coordinates are mapped 3D world space points at \(z_{near}\), \(z_{far}\) ?