Basic Illumination

Document Sample
Basic Illumination Powered By Docstoc
					                       Basic Illumination

Larry F. Hodges, G. Drew Kessler            1
      Light Source Independent Models
       Depth Shading
           • Color or intensity determined solely by elevation "depth" of polygon.
           • Darker colors or intensities at lower elevations.
           • Effective in modeling terrain or surface data
           • Avoids complex calculations of lighting dependent models
           • Simulates realism

       Depth Cueing
           • Reduce intensity of pixel as the distance from the observer increases
           • Simulates reduction in clarity as distances from the observer increases
           • Image fades in the distance
           • Often used in medical imaging

Larry F. Hodges, G. Drew Kessler                                                       2
      Light Source Dependent Models
       What an object looks like depends on
           • Properties of the light source such as color, distance from object,
           direction from object, intensity of source
           • Surface characteristics of object such as color and reflectance
           • Location of the observer

       Light striking a surface of an object can be
           • Reflected (Diffuse reflection & Specular reflection)
           • Absorbed
           • Transmitted (Translucent or transparent)
           • Combination of all three

Larry F. Hodges, G. Drew Kessler                                                   3
      Diffuse Reflection using Lambert's Law
       Lambert's Law - The intensity of light reflected from a surface is
         proportional to the cosine of the angle between the vector L to the light
         source and the normal vector N perpendicular to the surface.

                                      N (Normal)
                                                        L (Light Source)


       The amount of reflected light is dependent on the position of the light
         source and the object but independent of the observer's position.

Larry F. Hodges, G. Drew Kessler                                                     4
      Simple Illumination Model
           I = Illumination intensity
           Ip = Point light source intensity (white light)
           kd = Surface reflection coefficient (0kd  1)
       A simple illumination model: I = Ipkd(cosß)

       Since cosß = (L•N)/(||L|| ||N||), then if L and N have unit length then we
         can use
                                                             N (Normal)
                                                                          L (Light Source)

        I = Ipkd (L•N)


Larry F. Hodges, G. Drew Kessler                                                       5
      Ambient Illumination
       Ambient light is the illumination of an object caused by reflected light
        from other surfaces. To calculate this exactly would be very
        complicated. A simple model assumes ambient light is uniform in the

                    Ia = Ambient light intensity
                    ka = Ambient light reflected

       Then we modify our previous illumination model to
                    I = Iaka + Ipkd (L•N)

Larry F. Hodges, G. Drew Kessler                                                  6
      Light-source Attenuation
       Thus far we have ignored the inverse square law: energy decays with the
         inverse square of the distance dL to the light source. Including this term
         we get
                                       I = Iaka + Ipkd (L•N)/dL2

       However, due to our previous assumptions of a point light source and
        uniform ambient light, using the dL2 term gives too rapid of a decrease
        in illumination intensity to look realistic. The dL2 term is usually
        replaced by 1/fatt where
                                   fatt = MIN (1/(c1 + c2dL + c3dL2), 1)

                                       I = Iaka + Ipkd (N•L)*fatt

Larry F. Hodges, G. Drew Kessler                                                      7
      Specular Reflection
       •Light bounces off a glossy surface maintaining the color of the light
       •Visible when the angle of incidence of the light from the point light
         source is equal to the angle of reflection toward the observer.
       •For a nonperfect reflector, intensity of reflected light decreases rapidly as
         angle to observer increases beyond the angle of incidence.

             Position of                                      V = Observer Position
             Max Specular
              Reflection                   N            L     N = Normal Vector
                  R                                           L = Light Src Vector

                                   ß   ø       ø

Larry F. Hodges, G. Drew Kessler                                                        8
      Phong's Highlighting Term
        Ipfatt W(ø) cosnß
       Ip = Point light source intensity
       fatt = Light-source Attenuation
       W(ø) = Fraction of specularly reflected light (usually a constant, ks)
       n = Specular reflection exponent
       cos ß = R • V          (if R and V are of unit length)

                          I = Iaka + Ipkd (N•L)*fatt + Specular Component
                                   Specular Component = Ipfatt W(ø) cosnß
       This term represents the amount of the light source’s color that should be

Larry F. Hodges, G. Drew Kessler                                                    9
      Illumination and Color Models
       The illumination equation for many sources of white light is:
                                   I = Iaka + sources(Ip fatt (kd (N•L) + ks(R•V)n))
       Colored lights have different intensities for different wavelengths.
       A colored object reflects light of some wavelengths more than others.
       Handling the R, G, and B wavelengths separately gives a rough (incorrect, but
       acceptable) approximation of this:
       Ambient color: (IaR, IaG, IaB), Diffuse color of light source: (IpR, IpG, IpB)
       Object’s color: (OR, OG, OB)
                          IR = IaRka OR + sources(IpR fatt (kdOR(N•L) + ks(R•V)n))
                          IG = IaGkaOG + sources(IpG fatt (kdOG(N•L) + ks(R•V)n))
                          IB = IaBkaOB + sources(IpB fatt (kdOB(N•L) + ks(R•V)n))

Larry F. Hodges, G. Drew Kessler                                                        10
      Too Intense
       With multiple light sources, it is easy to generated values of I > 1
       One solution is to set the color value to be MAX(I, 1)
       • An object can change color, saturating towards white
                   Ex. (0.1, 0.4, 0.8) + (0.5, 0.5, 0.5) = (0.6, 0.9, 1.0)

       Another solution is to renormalize the intensities to vary from 0 to 1
         if one I > 1.
       • Requires calculating all I’s before rendering anything.
       • No over-saturation, but image may be too bright, and contrasts a
         little off.

       Image-processing on image to be rendered (with original I’s) will
         produce better results, but is costly.
Larry F. Hodges, G. Drew Kessler                                                11