In render_image
, we gave an arbitrary color so far. Instead, define and use the following function
color ray_color(const ray& r)
where the return color will blend white and blue depending on the height:
(1-a) * color(1.0,1.0,1.0) + a * color(0.5,0.7,1.0)
where a=0.5 * (unit_vector(r.direction()).y() + 1.0)
. Remark it goes to 0 when looking down, to 1 when looking up.