title: The right model for shading in Ray tracing
body: <p>I am wondering about the most accurate way to calculate the shadow generated from several different light sources and ambient light.
  Ambient light is light that exists in the entire 'world' with the same intensity and no particular direction, and diffused lighting is the lighting that occurs due a direct lighting from a point light source.</p>
  
  <p>Given that <code>Ka</code> is the coefficient for the surface ambient reflectivity, <code>Ia</code> is the intensity of the ambient light, <code>Kd</code> is the surface diffuse reflectivity, <code>Ip1</code> is intensity of the the first (accordingly) point light source, <code>N</code> is the surface normal, and <code>L1</code> is the light (of the first source accordingly) direction.</p>
  
  <p>According to my reference material the intensity of the color at the spot should be:</p>
  
  <p><code>I=Ka.Ia+Kd(Ip1(N.L1)+Ip2(N.L2))</code>
  where '<code>.</code>' is the dot product.</p>
  
  <p>But according to my understanding the real light intensity should do some sort of average between the light sources and not just add them up, so that if there are only two light sources the equation should look like:</p>
  
  <p><code>I=Ka.Ia+Kd(Ip1(N.L1)+Ip2(N.L2))/2</code></p>
  
  <p>and if there are 3 light sources, but the third is blocked and doesn't light the surface directly then:</p>
  
  <p><code>I=Ka.Ia+Kd(Ip1(N.L1)+Ip2(N.L2))/3</code>
  (so that if there is a place where all 3 lights contribute it would be lighten brighter.</p>
  
  <p>Am I right at my assumption?</p>