Graphics Reference
In-Depth Information
See also
F The Loading and compiling resources asynchronously recipe in Chapter 11 ,
Integrating Direct3D with XAML and Windows 8.1
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:
Static cubic environment map with texture array indices.
Note that the cube map is defined using a left-handed coordinate system (that is, +Z is
forward, +X is to the right, and +Y is upward). Our recipe will, therefore require axis scaling
and vertex winding changes when generating dynamic cube maps.
The Collosseum cube map is by Emil Persson, who has a number
of static cube map textures released under a Creative Commons
Attribution 3.0 license available at http://www.humus.name/
index.php?page=Textures .
 
Search WWH ::




Custom Search