Graphics
Ray Casting Tutorial – Part 4
May 17, 1996
0

<<PREVIOUSTABLE OF CONTENTS | CONTINUE >>

RAY-CASTING STEP 2: DEFINING PROJECTION ATTRIBUTES

Now that we have the world, we need to define some attributes before we can project and render the world. Specifically, we need to know these attributes:

  • 1. Player/viewer’s height, player’s field of view (FOV), and player’s position.
  • 2. Projection plane’s dimension.
  • 3. Relationship between player and projection plane.

The player should be able to see what is in front of him/her. For this, we will need to define a field of view (FOV). The FOV determines how wide the player sees the world in front of him/her (see Figure 8). Most humans have a FOV of 90 degrees or more. However, FOV with this angle does not look good on screen. Therefore, we define the FOV to be 60 degrees through trial and experimentation (on how good it looks on screen). The player’s height is defined to be 32 units because this is a reasonable assumption considering that walls (the cubes) are 64 units high.


Figure 8


To put the player inside the world, we need to define the player’s X coordinate, the player’s Y coordinate, and the angle that the player is facing to. These three attributes forms the “point of view” of the player.

Suppose that the player is put somewhere in the middle of grid coordinate (1,2) at a viewing angle of 45 degrees relative to the world, then the player’s point of view and FOV will be like inFigure 9. (One grid consist is 64 x 64 units. Thus, we can also say that the player is in unit coordinate (96,160)).


Figure 9
Player is in the middle of grid coordinate (1,2) or unit coordinate (96,160) with a viewing angle of 45 degrees and a field of view of 60 degrees.


We need to define a projection plane so that we can project what the player sees into the projection plane. A projection plane of 320 units wide and 200 units high is a good choice, since this is the resolution of most VGA video cards. (Video resolution is usually referred in pixels, so think of 1 pixel as equal to 1 unit.)
When the player’s point of view is projected into the projection plane, the world should look like the scene in Figure 10 below.

Figure 10

 <<PREVIOUSTABLE OF CONTENTS | CONTINUE >>