The only viable way I can think of is to add a behaviour to writing_ppm(): when we write the color intensities of pixels into files, we set the intensity of the brightest pixel to be 1, and scale down all intensities by that factor. However, this would mean that every picture we generated would be of the same brightness.
We might track how many light sources have we taken in the recursive calls of raycolor(). However, that would change the function signature.
Is there a better way of clamping down the color intensities?
The only viable way I can think of is to add a behaviour to writing_ppm(): when we write the color intensities of pixels into files, we set the intensity of the brightest pixel to be 1, and scale down all intensities by that factor. However, this would mean that every picture we generated would be of the same brightness.
We might track how many light sources have we taken in the recursive calls of raycolor(). However, that would change the function signature.
Is there a better way of clamping down the color intensities?