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

<<PREVIOUSTABLE OF CONTENTS | CONTINUE >>

FLOOR CASTING (Continued)

The math behind floor-casting is explained in the Figure 25 below.

Figure 25: The math behind floor-casting.

To reiterate, take a look at the illustration while reading these steps:

* Start from the bottom of the wall slice.

  1. Take the pixel position (you have this value when you did the wall casting).
  2. Draw a line (a ray) from the pixel to the viewers eye.
  3. Extends the line so that it intersect the floor.
  4. The point where the line “intersect” the floor is the point on the texture map that is being hit by the ray.
  5. Take the pixel value of that point on the texture map (see the next figure to see how this can be done) and draw it on the screen.

* Repeat 1-5 until the bottom of the screen is reached.

 

  <<PREVIOUSTABLE OF CONTENTS | CONTINUE >>