How you create an image using Ray Tracing
Then you have a model where you firing so many rays of light in general, some of these rays will reflect/absorb or refract etc and you calculate ray will interact with which object
What I don't see however is how a picture is created using raw code. Could somebody enlighten me?
No offense, but maybe you should post in "For Beginners" for now...
What I don't see however is how a picture is created using raw code. Could somebody enlighten me?
A) you don't understand how a rendering is accomplished (at all) using code
B) you don't understand how a scene/model can be described using code
C) you don't understand how something is drawn to the screen, or an image file
D) none of the above.
I don't really understand your question, but let me try a quick overview step by step.
An image is a rectangle filled with pixels. You can assign colors to pixels however you like. Eg: white to pixels whose Y coordinate is bigger than a value, black for the others. I guess that's easy to understand.
Now let's change the criteria. Say we have a 2D circle mathematically defined and we assign white to pixels that are inside and black to pixels that are outside (easy to test via the equation of a circle). Easy, right? We have the image of a circle.
The next step is steeper. Now we assume we have a 3D sphere defined mathematically and we give our pixels 3D coordinates (mathematically, we assume our pixels are in a 3D plane. Why not?). And our criteria now is: we shoot rays from a fixed 3D point and through the pixels, and if they intersect with the sphere we mark the pixel darker the further along the ray it intersects, or pure black if it doesn't intersect the sphere at all. You get something like this: http://www.geekshavefeelings.com/x/wp-content/uploads/2009/12/Diffuse-lighting-sphere.png .
Now, if instead of just marking the pixel darker the further the ray intersects, you compute how much light reaches that intersection point, you get something like: https://www.cl.cam.ac.uk/teaching/2000/AGraphHCI/AG/img/rtsph.gif.
And of course, by improving this criteria (using different lighting techniques, for example) and having more interesting models than just a 3D sphere, you can generate cool images.