This is the first part of the ray tracing series of tutorials. We've seen in the introduction what a raytracer was and how it was different from other solutions. Now let's concentrate on what it would requires to implement one in C/C++.
Our raytracer will have the following functionality. It will not try to be real time, and so will not take shortcuts because of performance only. Its code will try to stay as straightforward as possible, that means we'll try not to introduce complex algorithms. If we can avoid it. We'll make sure the basic concepts explained here will be visible in the code itself. The raytracer will work as a command line executable, that will take a scene file such as this one and output an image such as this one :






It would be helpful if the variable names in the sample code were given descriptive names, rather than single letters.
Yes that's what I usually try to do. If you refer to the sphere intersection equation, those are mathematical variables so they don't have more descriptive names (unless you consider delta to be more descriptive than, say, D in an equation).
Of course not all is perfect, but pointing to the specific problem you have could help to improve this article as well.
Post new comment