The [[Set]] of all [[Point|Points]] in space visible to a [[../Computer Science/Perspective Projection|Camera]].
### Variables Required
Given some camera with the following data:
- [[../Computer Science/Triangle Orientation|Orientation]]
- $\vec u=$ [[../Math/Unit Vector|unit]] right vector
- $\vec v=$ [[Unit Vector|unit]] up vector
- $\vec n$ = [[Unit Vector|unit]] back vector $\vec u \times \vec v$
- Location:
- $E=$ center of projection
- Geometry:
- $w=$ width of [[Perspective Projection|Viewport Rectangle]]
- $h =$ height of [[Perspective Projection|Viewport Rectangle]]
- $D=$ Distance between $E$ and center of the [[Perspective Projection|Viewport Rectangle]]
- Clipping [[../Math/Distance|Distances]]:
- $N=$ Near distance, distance from $E$ to the [[Near Clipping Plane]]
- $F=$ Far Distance, distance from $E$ to the [[../Math/Far Clipping Plane|Far Clipping Plane]]
This camera defines a pyramid [[View Volume]].
![[../../00 Asset Bank/Pasted image 20250131091532.png]]
We assume that:
- The vectors $\vec u, \vec v, \vec n$ are all [[../Math/Orthonormal|Orthonormal]].
- Center of the [[Perspective Projection|Viewport Rectangle]] is $C=E-D\vec n$
#### Specifying data in a more intuitive way
The data required to create [[Perspective Projection]] can be represented more intuitive variables, and converted to the required format when you need to use with calculations.
- $\vec l=$ look at [[../Math/Vector|Vector]] (not necessarily a [[../Math/Unit Vector|Unit Vector]])
- $\vec r=$ relative (global) up [[../Math/Vector|Vector]], typically in the direction opposite to the pull of [[Gravity]]
$\vec l$ and $\vec r$ can be used to generate the camera orientation [[Vector|Vectors]] $\vec u,\vec v, \vec n$.
$\huge \begin{align}
\vec n &= - \frac{\vec l}{\lvert \vec l \rvert }\\
\vec u &= \frac{{\vec l \times \vec r}}{\lvert \vec l \times \vec{r} \rvert } \\
\vec v &= \vec n \times \vec u
\end{align}$
To specify the geometry:
- $\alpha=\frac{w}{h}=$ Aspect ratio
- $\theta=$ [[Field of View]] angle / angle between the left and right edges of the [[Perspective Projection|Viewport Rectangle]] (measured by $E$).
$\huge \begin{align}
w &= 2D\tan\pa{ \frac{\theta}{2}}\\
h&= \frac{w}{\alpha}
\end{align}$