Implementing multithreaded dynamic cubic environment mapping
In this recipe, we will implement dynamic cubic environment mapping or cube mapping and explore how threading impacts the rendering performance. A cube map is commonly used for skyboxes with the camera located inside the cube. In this recipe, we will be using cube maps to implement reflections for objects. We will also be rendering directly to the cube map resource in order to implement dynamic reflections. In Direct3D, a cube map is implemented using a
texture cube; this is a special texture array with six slices where each slice represents a face of the cube along an axis. The TextureCube
HLSL shader resource provides built-in sampling support. The following figure shows a static cube map laid out flat, and the texture array indices are matched to the appropriate axis:
Note that the cube map is defined using a left-handed coordinate system (that is, +Z is forward, +X is...