1
$\begingroup$

I'm making a raytracing renderer, and I'm implementing lights. I read about the inverse square law, which I'm sure you know as:

$$intensity = \frac{k}{distance^2}$$

So for each point on an object I calculate the intensity like this, where $k$ is the energy of a light. However, what if there are multiple lights? How would I calculate the final intensity of a point?

Before anyone asks, I have searched for this on the web, but haven't found any relevant solutions.

A few solutions I've thought about, are:

$$intensity = \sum_n\frac{k_n}{distance_n^2}$$

So basically summing all of the intensities.

Another option would be

$$intensity = \prod_n\frac{k_n}{distance_n^2}$$

i.e. multiplying the intensities, but I don't think that would work if you consider any of the intensities being 0.

So is there some way of doing this, which I haven't found by googling my title?

$\endgroup$
0
$\begingroup$

In optics, the intensity of unpolarized incoherent light (i.e. white light that you would want to use in a raytracer) is additive, so adding together the intensities should work fine for a renderer, as long as you're not worried about things like diffraction or polarization.

$\endgroup$
2
  • $\begingroup$ Great, that makes it easy. $\endgroup$ – Jacob Garby Mar 24 '18 at 16:57
  • $\begingroup$ (I can't accept the answer for another 10 minutes - thanks for the fast response) $\endgroup$ – Jacob Garby Mar 24 '18 at 16:57
0
$\begingroup$

Your equation $$intensity = \sum_n\frac{k_n}{distance_n^2}$$ is correct.

"..lumens (and lux and candela etc etc) are linearly additive but perceived brightness is logarithmic."

from:

http://www.candlepowerforums.com/vb/showthread.php?189362-Do-lumens-add-up

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.