# CS488 - Introduction to Computer Graphics - Lecture 17

## 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

Model of body reflection

• good model of most artificial surfaces
• paint
• plastic
• cloth (most types)

and many natural surfaces

• human skin (sort of)
• plants (most parts)
• animals (most parts)
• etc.
• light direction completely randomized
• outgoing direction independent of incoming direction
• completely specified by reflectance function, R(\lambda)

#### How much light hits the surface?

1. Idealize light sources as points emitting light
1. How much light does a source emit?
2. How much light is there at a distance r from the source?
• Segregate the light by direction
• How much light per unit angle?
3. How much light per square metre?
• Falls off with distance.
• How? Think how big the surface of a sphere is.
4. How much of the surface does a square metre of the sphere cover?
• Depends on the angle
• How?
2. What if the lights were (infinite) lines?
• Why is an infinite line the same as a circle?
3. What if the lights were (infinite) planes?
• Why is an infinite surface the same as a sphere?
• In computer graphics this is called ambient light.
4. What do we do in practice?

Comment. Two general aspects of the above are very important to getting things right in computer graphics

1. The scaling arguments from dimensionality
2. The geometric derivations of angular facts from small areas

#### 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.
• Called `gloss'.
• 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 lighting 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