# CS488 - Introduction to Computer Graphics - Lecture 19

## Review

1. Illumination
2. Ambient illumination
3. Notes terminology
• l - the ray from the light osurce to the surface
• n - the normal to the surface
• v - the direction to the eye
• r - the specular reflection direction
• Lin, Lout

## Lambertian Surfaces

#### How much light leaves the surface?

This material is described with diagrams here.

We are only interested in the light leaving the surface in a particular direction. Why?

The light divides into two parts at the surface

• part is reflected: surface reflectance'
• part enters the surface: body reflectance'

The simplest model of body reflectance is Lambert's cosine law. Surfaces with body reflectance following Lambert's cosine law are called Lambertian.

What makes a Lambertian surface Lambertian?

• Half-sphere within the body, centred at the bit of surface
• Half-sphere above the body, bottom at the surface
• Draw a little cylinder passing through the centre.
• Whatever goes in the bottom comes out the top
• modified by the angular size of the hole
• cosine factor

What goes into the eye

• Same geometry as illumination, only backward
• cosine factor
• Cosine factors cancel one another

Important point

• The ubiquitous cosine terms (l.n, v.n, etc.) occur whenever we translate between areas on a plane and areas on a sphere.

What colour is the light?

• Each time the incoming light interacts with a pigment particle its spectral content is multiplied by a particle property, r(\lambda).
• E1(\lambda) = E(\lambda) * r(\lambda)
• It can interact many times
• Assuming only one type of particle,
• En(\lambda) = E(\lambda) * ( r(\lambda) )^n
• When the light re-emerges from the surface fraction fi of the light has interacted i times
• Light re-emerging has spectral content E(\lambda) * \sum_i fi ( r(\lambda) )^i
• R(\lambda) = \sum_i fi ( r(\lambda) )^i is called the body reflectance.
• In real calculations we discretize wavelength

Using only three samples we get the RGB model

• Illumination (Ir, Ig, Ib)
• Reflectance (Rr, Rg, Rb)
• Outgoing light: (IrRr, IgRg, IbRb)

## Highlights

Part of the light didn't enter the body of the surface, but was reflected

• Called surface reflection'
• Where does it go to?

Suppose the surface is smooth

• It is reflected, called spectular'
• which means out = in - 2 * (in.normal) normal
• what is the colour?
• does it enter the eye?

Suppose we roughen the surface just a little

• The light spreads a little, centred on the specular direction.
• Amount entering the eye depends on the angle between the eye ray and the specular direction

And if we roughen the surface a lot

• The light goes out all over the place
• This is called a matte surface

Here is the hack

• Named Phong shading after Phong Bui-Tuong
• Let the specular term be ( r.v )^p
• small p - matte
• large p - highly specular

How is the incoming light divided between ambient, surface and body reflection?

• Depends on the surface
• L(\lambda) = Ia * ka(\lambda) + Id * (l.n) * kd(\lambda) + Is * ( r.v )^p * ks
• Implicit v.n / v.n in the second term
• Missing 1 / v.n in the third term