Ray Casting Tutorial – Part 11
May 17, 1996



To draw floors, we can perform floor-casting (floor-casting refers to a techique of rendering floors). Note however, that it would be wasteful to perform floor-casting without texture mapping or shading. In other words, if the floor is not to be textured or shaded (shading will be explored later), then we can simply paint the floor with a solid color and we are done. Keeping that in mind, let us explore what is required to do floor-casting.

There are several ways to do floor-casting. However, all of them use a similar technique. The technique is explained below.

      1. Find an intersection with the floor.
      2. Determine the world coordinate of the floor that had been intersected.
      3. Calculate the distance between the player and the floor intersection.
      4. Project the floor intersection onto the projection plane.

Note that it is not necessary to draw all the floors. We should only draw floors that are not covered by walls. For that reason, we should start the casting from the bottom of the wall slices. From the bottom of the slices, we then scan every pixels on the projection plane in downwarddirection (i.e.: cast rays subsequently in downward direction). This time, however, instead of looking for intersection with walls, the ray looks for intersection with the floor.

Figure 24: Floor casting.


Remember, the we do not need to cast beyond the projection plane. (Ie: cast from the bottom of the wall slice, row by row in downward direction; stop when the bottom of the projection plane is reached.)