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

<<PREVIOUSTABLE OF CONTENTS | CONTINUE >>

By knowing the field of view (FOV) and the dimension of the projection plane, we can calculate the angle between subsequent rays and the distance between the player and the projection plane. These steps are illustrated inFigure 11 (Many books define these last two values arbitarily, without telling the reader where the values come from, here is the justification.)


FIGURE 11
Here is what we know:


Here is what we can calculate (most of these are high school level math, I recommend brushing up on Trigonometry/Pythagorean theorem if you don’t understand):

 


So now we know:

  • Dimension of the Projection Plane = 320 x 200 units
  • Center of the Projection Plane = (160,100)
  • Distance to the Projection Plane = 277 units
  • Angle between subsequent rays = 60/320 degrees

(We will occasionally refer the “angle between subsequent rays” as the “angle between subsequent columns.” Later, this angle will be used to loop from column to column. The distance between player to the projection plane will be used for scaling.)

<<PREVIOUSTABLE OF CONTENTS | CONTINUE >>