\section{Deferred Texturing}

For height map composition, we must iterate over all height maps and combine the height values for each grid point.
The accumulated heights are stored in a buffer of 32-bit floating points that has the same dimensions as the projective grid.
This process can be performed on the GPU by using the map equations from \Section{mapProj}.
Color and surface normal data is composited in a similar manner, expanded for three channels of data.

The sphere normals, positions, and accumulated heights buffers describe the final terrain mesh.
In order to decouple the performance of PGM from the performance of deferred texturing, we rasterize the grid-sized buffers into screen-sized buffers, an optimization described by Kooima~\cite{Koo08}.
This accomplishes performance throttling by allowing the grid size to differ from the screen size.

In order to use the three buffers as geometry, we render a triangle strip where each vertex corresponds to a grid point in the projective grid.
Each vertex then has an $(x,y)$ position equal to the corresponding grid point's texel coordinates within the three buffers.
By sampling each buffer, we can determine the vertex's final position, which is displaced along the sphere normal.

To mitigate the issues of 24-bit depth buffer precision, we perform a two-pass rasterization approach~\cite{Bra07}, rendered with a near frustum and a far frustum.
If secondary objects are to be rendered, a stencil buffer can be maintained to track which pixels are occluded by the near terrain.

The final step is to render the outer atmosphere and combine the accumulated color and surface normal buffers using standard Phong lighting equations with atmospheric effects.
The shaders for rendering the outer and inner atmospheric effects are given by Sean O'Neil~\cite{ONe05}.
