PowerPoint Presentation
9. Blinn-Phong Illumination
Dr. Hamish Carr
COMP 5812M: Foundations of Modelling & Rendering
Local & Global Illumination
Local illumination simplifies lighting
All surfaces get the same lighting
I.e. the light interacts with every surface
Other objects don’t block the light source
And indirect lighting is ignored
Global illumination is better, but more costly
So we will use local illumination
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Origin of Photons
For any point, light comes from all over
Surface
Normal
Stray
Photons
Eye
Perfect
Reflection
Angle
Imperfect
Reflection
Angle
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Phong Lighting Model
Total lighting at a point is:
specular (shiny) reflection, plus
diffuse (matt) reflection, plus
ambient (background) reflection, plus
emitted light
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Emitted Light
Light from a glowing object
For simplicity, uniform in all directions
Not affected by incoming light
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Ambient Lighting
Some photons have bounced around
Hard to identify their source
Roughly same number everywhere
Surface
Normal
Stray
Photons
Eye
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Ambient Light
Ambient light is uniform
on all surfaces
but some reflect more
so it has two terms
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Perfect Reflection
Angle of incidence = angle of reflection
so normal vector is bisector
Eye
Θ
Θ
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Specular Reflection
Specular light spreads out a little bit
Reflects strongly for angles close to perfect
i.e. if the bisector is close to n
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Specular Reflection
Based on angle between normal and bisector
Use an exponent to adjust size of highlight
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Specular Highlights
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Diffuse Light
Diffuse light is from rough surfaces
rough at the microscopic scale
normal is essentially random
although surface is oriented
Diffuse light still uses normal vector
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Diffuse Lighting
At large angles, light is more spread out
Light per unit area proportional to cos
But not to cos
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Diffuse Computation
Light is spread over surface
depending on incident angle
but not on reflection angle
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Putting it Back Together
And that’s only for greyscale
for colour, do this once each for R,G,B
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
One Step At A Time
RGB ~ αβγ (debug)
RGB ~ i,j (debug)
Lambertian (diffuse)
Blinn-Phong
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Gouraud vs. Phong Shading
Gouraud shading computes light per vertex
Then interpolates colour across triangle
Phong shading computes light per point
Needs interpolated normal across triangle
And is more expensive computationally
Raycasting normally uses Phong shading
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering
Saving to PPM File
A common convention when testing
Dump the image to a file
PPM is a very simple text format
Inefficient, but simple
Simplifies the debug cycle
But only allows integer values
Usually in the range 0-255
COMP 5812M: Foundations of Modelling & Rendering
COMP 5812M: Foundations of Modelling & Rendering