A [[Cube Map]] is a common type of [[Environment Map|View Dependent Environment Map]] that can be used for arbitrary objects. A cube map consists of 6 flat [[Bitmap Image|texture maps]] aligned to each coordinate [[Axis]].
>[!info] Prons & Cons
>*Pros*:
>- Little distortion
>- No pole / boundry interplatino problems
>- Can be generated programmatically
>- View Independent
>
>*Cons*:
>- Need 6 seperate images
### Generation
We can generate a cube map by doing the following:
- Locate a camera at the center of the reflective object
- Set FOV to $90\degree$ and aspect ratio $\alpha=1$
- For each side map (6 times)
- Orient camera to point at the side
- Build view / projection transforms
- Render the scene into that texture
### Mapping
For each visible [[Pixel]] of the reflective surface:
- Calculate $\hat{R}$ based off of the [[Normal Vector]] and [[View Frustum|View Vector]] $\hat{v}$
- Choose the texture map based on the greatest magnitude of $R$
- Intersect $R$ with the face
$\huge R' = \frac{\braket{R_{x},R_{y},R_{z}}}{
\max\pa{ |R_{x}|, |R_{y}|, |R_{z}| } } $