Let's assume that the lower left corner of the screen corresponds to (-1.0, -1.0)
and the upper right corner is (1.0, 1.0)
. The z coordinate is 0.0
:
A ray extends from the origin O to the point with coordinates of the current fragment:
Calculate the length of the ray for each fragment and output the value as the red color channel. Consider the aspect ratio of the screen.