As you might know, I’m a HUGE fan of “Colin McRae: DiRT 2” the Racing Game.
I like everything in the game, but one of the things that grabbed my attention was the Loading Screen because it switches from a 3D Environment to a 2D image on a Photograph in a very cool way, and one day when I was thinking about it from a programmer’s point of view, I found out that this part can be easily implemented on XNA, so I decided to do it in my free time.
What happens in DiRT 2’s Loading Screen is, for example before starting a race when you pick the car you’re gonna race with, the camera looks at the car then you hear a Camera Shutter sound, then you see the Car as a Photograph on a map along with other stuff, then after loading is complete the Camera zooms on another Photograph which turns out to be the Race Track !
The whole thing is very simple if you know about the GraphicsDevice.ResolveBackBuffer() method which basically turns whatever you see in your Game Window into a Texture (actually it stores it in a ResolveTexture2D object which inherits from Texture2D).
All what I had to do was to make a simple 3D Model (for the photograph) that has a black texture applied to a certain part of a surface, this black texture is then replaced by the Texture returned by the GraphicsDevice.ResolveBackBuffer() method.
If you Build the project you’ll see a tweaked version of the famous “p1_wedge” model from the XNA 2.0 SpaceWar Starter Kit (I tweaked back in the days when I was doing my Asteroids Game ), you can rotate the camera around it using W, S, A and D; and you can zoom in and out with R and F, to take a Photo (or Snapshot) press the Spacebar, you’ll see that a photo appears in front of (and facing) the camera showing the Snapshot you took, you can repeat this as much as your computer can take, looks cool right ?