Cube mapping: Making a sky sphere

The second effect we will discuss is called cube mapping. A cube map is like a texture, but it actually contains six textures—one for each side of a cube:

Cube mapping: Making a sky sphere

Cube mapping is any process that involves sampling pixels from this texture. In the following sections, we will use the preceding cube map to simulate reflections off of an object, and to simulate a sky wrapped around the scene. Let's start with the sky.

We start by creating a new class SkySphere that keeps track of a model and an effect. The model is simply a sphere that our cube map will be drawn onto, and the effect (which we will create next) does that drawing. ...

Get 3D Graphics with XNA Game Studio 4.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.