What's the concept of "Ray" really? I'm learning Ray Tracing using this MIT tutorial.

I've heard Ray Tracing only in the context of lighting. I.e. I understand that ray casting is used to light an object that has been already drawn. However, I've also seen ray casting in the context of just drawing the picture (not lighting). So which one are rays about?

What's the concept of "ray" really?

E.g. in that tutorial one draws the picture like:

image.SetPixel( x, y, pixelColor );


where pixelColor has been acquired from the Ray Caster. But I read this to mean that pixelColor already has lighting information.
A ray is just a semi-infinite line, and casting the ray finds intersections between the ray and an object in the scene. It doesn't just tell you the position in space that the ray intersected the object: it also tells you the texture co-ordinates of that point on the object, the surface normal and tangent, and (depending on the algorithm you use) filter widths.

So in a ray-tracer, there are different kinds of rays. Primary rays and reflection and refraction rays use their intersection to run a shader and compute a fragment colour. They also fire shadow rays at lights, which don't compute a colour but just tell you whether any object is shadowing the light.

So rays are about finding the objects which are in the scene, and shading those objects to make an image. They're also about finding the reflections and refractions on shiny objects. They are used to draw shadows. They're also used for more advanced effects like ambient occlusion and photon tracing.

This is one of the main conceptual advantages of ray-tracing over scanline rasterisation: instead of having to use different techniques for computing reflections, shadows, and all those other effects, the same core ray-cast algorithm can be used recursively to compute the whole image.