[[Polar Coordinates|Polar]] Spherical [[Function|Mapping]] is a form of [[Environment Map]] where the [[Bitmap Image|Texture]] is wrapped around a sphere. Each [[Texel]] corresponds to a direction in polar coordinates, where we assume the view vector goes through the spheres center.
This type of map is view-independent.
*Pros*:
- Simple
- View Independent
*Cons*:
- Bad distortion near the poles
- [[Texture Coordinates]] [[Linear Interpolation]] fails when cross-boundry / contains poles
- Image is not trivial to generate
- Expensive to build the texture map
$\huge \begin{align}
\phi &= 2\pi u \\
\theta &= \pi v \\
u,v &\in [0,1] \\
\phi &\in [0, 2\pi] \\
\theta &\in [0, \pi] \\
\end{align}$
We can use the spherical equation to compute $P=(x,y,z)$
$\huge \begin{matrix}
x = \sin(\phi)\sin(\theta) & y = \cos\theta &
z = \cos(\phi) \sin(\theta)
\end{matrix} $
We can cast a [[Ray]] $(\mathcal O,P)$ and calculate its intersection with the sphere to obtain a color.
To calculate the [[Texture Coordinates|Texture Coordinate]] from a view vector we use:
$\huge \begin{align}
(u,v) &= \pa{
\frac{\arctan\pa{\frac{x}{z}}}{2\pi},
\frac{\arccos (y)}{\pi}
}
\end{align}$