How does real-time raycasting work?

A precise answer would be very long and mathematical at this point.If a mathematical representation is desired, I can also try it on request. But that will take some time. Therefore, first of all without mathematics and informal.

There are different approaches to raycasting.But what happens in raycasting?
There is somewhere one (or more) light source L.
There is one (or more) viewer B.
Here left B and right L.
Raycasting determines whether B can see light rays from L and, if so, where and how strong and in what colors.Without reflections, the whole thing is quite simple, since it is only necessary to check whether there is a direct connection from B to L. With reflections, it’s much more complicated.

In the following example, there is a wall in the middle.So the viewer sees nothing of the light. How does the computer “know” that this is the case? This is done with beam tracking.

What is the following example?

In this image, it is possible that light falls from the light source onto the viewer.

It is reflected on the walls. Indicated by the black lines.

The problem is that a light source theoretically emits an infinite number of light rays.

In addition, each of these rays is reflected infinitely often. It is impossible to track each and every one of them. Usually, the number of light reflections is therefore limited. In reality, a single beam of light becomes weaker with each reflection, as the light is scattered. In the computer graphic, a value is set for this purpose and simply no longer reflected from the Xth reflection. There are several different approaches to beam tracking. For example, there is the forward tracking of light source to the observer. Or the traceability from the observer to the light source. Or both approaches are combined and rays are tracked more or less simultaneously by the observer and the light source.
Real-time raycasting now works in such a way that all these calculations are performed.Again and again and again for a certain number of light rays.

The Wikipedia article contains a good collection of information.It doesn’t make much sense to put it this way again. Raytracing – Wikipedia

If I want to do the whole thing mathematically, I can do so gladly.But such an answer will certainly take me a few hours to formulate it sensibly. So I only do it if it is desired. If necessary, please ask in the comment. Then I revise the whole thing at a much higher level.

Leave a Reply