I'm working on a raytracer in Python (hey, something to keep me busy!), and I'm kind of stuck. Here's a pic of what I can do now (it took 20 minutes to render):
There are 50 light sources here, but the whole scene is kind of dim. That's because I basically take the mean of all light contributed by each light source to a point. Clearly this is wrong (adding a light of 0 intensity darkens the whole scene ), but I can't think of a "proper" physically accurate way to add light. I can't just directly add colors, or I'd end up with more than 100% intensity. I can't multiply all components, because then light would get dimmer. What do I do?
Offline
Maybe you could divide the intensity of a light by the square of its distance from the point, then add all of these? The trouble here is, you can get over 100% intensity. Another possibility is taking away each light's intensity from 100, multiplying all of these, then taking the result away from 100. That way, every light will add a bit of brightness, 0 intensity lights have no effect and the intensity will never go over 100%. I've never even touched raytracers, so I don't know whether this would work, but it might be worth trying.
Offline
Maybe just have a maximum value at 100%? Surely you have to limit the dynamic range of your (virtual) camera's sensor somewhere...
(I'm not sure if "dynamic range" is the right term here. I just mean the range of intensities that the sensor differentiates between.)
Last edited by blob8108 (2012-12-19 09:30:46)
Offline