11 - Lighting

ucla | CS 174A | 2024-03-18 22:08


Table of Contents

Types of lighting

  • ambient - instead of checking the physical scattering, we assume each object has ambient lighting directly behind it that gives us a silhoutte
  • diffuse - reveals shape of obj based on diffusivity of light across the surface of the object
  • specular - shine, shows specualr highlights of the light soruces

    Ambient Lighting

  • background light - estimates true scattering
  • does NOT depend on position/direction, object, or eye

    Diffuse Lighting

  • point source light
  • lambertian (diffuse) reflection for dull matte surfaces -> looks equally bright from all directions
  • reflect light equally in all directions
  • Lambert’s law: light intensity is prop to direction
  • N is the normal from/to the surface
  • L is the light vector (surface to light source)
  • θ is angle between N,L

    Specular Lighting

  • shiny surfaces
  • color of light matters (included in point light intensity) not color of object
  • depends on position of light, object and eye
  • R is the reflection vector from the surface
  • V is the view/eye/cam vector from the surface
  • fatt is attenuation factor: see Final Lighting
  • ϕ is angle between R and V

Calculating R vector

R=2(NL)N  L

Blinn-Phong: Replacing RV with Halfway Vector

  • halfway vector H is halfway b/w L and V = norm(L+V)
  • replace (RV)n with (HN)n
  • s.t. (HN)n=cosnΨ:Ψ=ϕ/2

    Final Lighting

    Iλ=(kaλIaλ)Odλ + (fattkdλIpλ(NL))Odλ + (fattksλIdλ(RV)n) where λR,G,B

    Incident Angle

  • angle is angle bw norm to surface and light source
  • θ<90 => some light based on angle
  • θ=90 => max light
  • θ>90 => self-occlusion, no light

    Directional light sources

  • if light is far enough away
  • L is the same (constant) for the entire scene for all objects
  • N is the same for the entire polygon
  • thus NL is constant on the poly

    Attenuated Light source

  • diffuse light reflected off object
  • d is the distance of the light to the object

    Colored Light Sources

    OBJECT COLOR (not light color)

  • object’s diffuse color OdλOdR,OdG,OdB
  • split into R,G,B components
  • thus final term => (ambient + diffuse term) * Odλ

    Fog: Atmospheric Attenuation and Blending

    Misc Improvements

Global Illumination

  • based on physics light energy (radiosity)