
CHAPTER 2 ■ SETTING UP DIFFERENT CAMERA MODES IN YOUR 3D WORLD
30
2-1. Set Up the Camera: Position, Target, and
View Frustum
The Problem
Before you can render your 3D world to the screen, you need set up your camera. You do this
byspecifyingtheViewandProjectionmatrices.Beforerendering,bothmatricesareneededso
the graphics card can correctly transform your 3D world to your 2D screen.
The Solution
Setting up your camera in your 3D world comes down to specifying two matrices.
You can save the camera position and direction in a single matrix, which is called the View
matrix.TocreatetheViewmatrix,XNAneedstoknowthePosition,Target,andUpvectorsof ...