I want to do a programmatical RayTracer
in Java
for demo purpose while giving a presentation about Ray Tracing in general (also mentioning 3D, this 2D model should only be for easier understanding, and to train my general Java knowledge).
My problem is, that i dont know where to start this whole thing.
The first thing i would try is to use vectors to trace every pixel on the screen from a given coordinate (eg. the position of my mouse cursor). Then I would calculate if the vector intersects with a polygon and then i would stop the vector there and draw it only to this specific point.
Maybe i could even draw some shadows by calculating the normal and reflect the vector in the other direction with a lower intensity.
So would it be a good idea to draw a vector from A = {everypixelonthescreen}
to a specific Point P
and calculate the intersections?
The finished version should look somewhat like this: