Light

Tom Kelliher, CS 320

Apr. 15, 2013

Administrivia

Announcements

Assignment

Read 5.4-5.6.

From Last Time

RoomView lab.

Outline

  1. Real world lighting.

  2. A lighting model.

  3. Types of shading.

  4. The Phong reflection model.

Coming Up

More light on light.

Lighting in the Real World

  1. Viewer, lights, objects.

  2. Light properties?

  3. Material properties: Translucence, reflectance (specularity), scattering (diffusion). Examples? Color of an object.

  4. How do lights and materials interact?

  5. The rendering equation. Calculation for each point in a scene.

  6. Need a balance between accuracy and efficiency.

  7. Local vs. global lighting. The graphics pipeline.

A Lighting Model

  1. General illumination function for a light source: $I(x,y,z,\theta,\phi,\lambda)$.

  2. Types of modeled light sources:
    1. Ambient light

    2. Point sources

    3. Spotlights

    4. Distant light sources

Color Sources

  1. Illumination function is a continuous function of wavelength.

  2. Complex computation, vision model.

  3. Luminance function:

    \begin{displaymath}
{\bf I} = \left[ \begin{array}{l}
I_r \\
I_g \\
I_b
\end{array} \right]
\end{displaymath}

Ambient Light

  1. Uniform light -- ``background'' light.

  2. Model:

    \begin{displaymath}
{\bf I}_a = \left[ \begin{array}{l}
I_{ar} \\
I_{ag} \\
I_{ab}
\end{array} \right]
\end{displaymath}

Point Sources

  1. Emits light equally in all directions.

  2. Assume point source at ${\bf p}_0$. Color vector:

    \begin{displaymath}
{\bf I}({\bf p}_0) = \left[ \begin{array}{l}
I_r({\bf p}_0) \\
I_g({\bf p}_0) \\
I_b({\bf p}_0)
\end{array} \right]
\end{displaymath}

  3. Illumination at $\bf p$ due to ${\bf p}_0$? Depends upon square of distance:

    \begin{displaymath}
{\bf I}({\bf p}, {\bf p}_0) = \frac{1}{\Vert{\bf p}-{\bf p}_0 \Vert^2}{\bf
I}({\bf p}_0)
\end{displaymath}

  4. High contrast harshness due to shadow effects: umbra, penumbra.

  5. In practice, replace inverse square term with

    \begin{displaymath}
a + bd + cd^2
\end{displaymath}

    where $d$ is the distance and $a$, $b$, and $c$ are constants chosen to soften.

Spotlights

  1. Simple spotlight: point source with light emitted only through narrow range of angles.

  2. Consider the source at ${\bf p}_s$ to be restricted by the cone described by ${\bf l}_s$ and $\theta$.

  3. For accuracy, distribution within the cone is modeled by $cos^e
\phi$.

Distant Light Sources

  1. Re-calculating the ${\bf p}_0$-${\bf p}$ vector.

  2. If the distance is ``large'' how much does the vector change?

  3. Replace source location with source direction:
    1. Near source: ${\bf p}_0 = \left[ \begin{array}{l}
x \\ y \\ z \\ 1
\end{array} \right]$ (a point)

    2. Far source: ${\bf p}_0 = \left[ \begin{array}{l}
x \\ y \\ z \\ 0
\end{array} \right]$ (a vector)

Shading

  1. Flat shading: each point on a polygon assigned same color.

  2. Gouraud (smooth) shading: assign colors individually to vertices, interpolate.

The Phong Reflection Model

  1. Consider an object point, ${\bf p}$ and a light source ${\bf p}_i$.

  2. Important vectors:

    \includegraphics{Figures/phong.eps}

    1. $l$: vector to light source.

    2. $n$: surface normal.

    3. $v$: vector to COP.

    4. $r$: reflection vector.

  3. The light from source to object can be described by:

    \begin{displaymath}
{\bf L}_i = \left[ \begin{array}{rrr}
L_{ira} & L_{iga} & L...
... L_{ibd} \\
L_{irs} & L_{igs} & L_{ibs}
\end{array} \right]
\end{displaymath}

    (theoretically wrong but, in practice, right)

  4. Using material properties, distance from viewer, orientation of surface and direction of source a reflection matrix can be constructed:

    \begin{displaymath}
{\bf R}_i = \left[ \begin{array}{rrr}
R_{ira} & R_{iga} & R...
... R_{ibd} \\
R_{irs} & R_{igs} & R_{ibs}
\end{array} \right]
\end{displaymath}

  5. (Simplified) Illumination at $\bf p$:

    \begin{displaymath}
I = I_a + I_d + I_s = L_aR_a + L_dR_d + L_sR_s
\end{displaymath}

    A global ambient term may be ``thrown'' in.



Thomas P. Kelliher 2013-04-13
Tom Kelliher