Ray casting is an algorithm used in image processing, and its objective is to synthesize 3D images. It can be defined as the first stage of the Raytracing algorithm, differing from it in its simplicity since Ray casting is not a recursive method.
This algorithm fires rays from the observer in order to perceive the distance of the objects that make up the scene, a camera field of view style.
Ray casting is actually used by the game: Wolfenstein 3D. DOOM, in fact, uses “Column-based rendering” which is a more advanced approach, where the environment is divided into sectors and lines of sight, but the result is very similar to Ray casting, since both are 2D, but DOOM is more considered a pseudo-3D.
In this tutorial we will see the development from scratch with C++ and SFML step by step of how Ray casting works.
The video is in Portuguese, however, it is possible to follow the logic, or, use both automatic translation and automatic dubbing from YouTube.