13.1 si23_03 si23 introduction to computer graphics lecture 13 – simple reflection model
TRANSCRIPT
![Page 1: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/1.jpg)
13.1Si23_03
SI23Introduction to Computer
Graphics
SI23Introduction to Computer
Graphics
Lecture 13 – Simple Reflection Model
![Page 2: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/2.jpg)
13.2Si23_03
What is a Reflection Model?
What is a Reflection Model?
A reflection modelreflection model (also called lightinglighting or illuminationillumination model) describes the interaction between light and a surface, in terms of:– surface properties– nature of incident light
Computer graphics uses a simplification of accurate physical models– objective is to mimic reality to an
acceptable degree
![Page 3: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/3.jpg)
13.3Si23_03
Phong Reflection ModelPhong Reflection Model
The most common reflection model in computer graphics is due to Phong Bui-tuong - in 1975
Has proved an acceptable compromise between simplicity and accuracy
Largely empirical It is a local reflection model – does
not handle global effects of light reflecting between surfaces
– Ray tracing and radiosity methods will handle this
![Page 4: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/4.jpg)
13.4Si23_03
Diffuse Reflection and Specular Reflection -
Phong Approach
Diffuse Reflection and Specular Reflection -
Phong Approach
microscopic view
whitelight
specular reflection (white)
diffuse reflection(yellow)
yellowpigment particles
Some light reflecteddirectly from surface.
Other light passes intomaterial. Particles ofpigment absorb certainwavelengths fromthe incident light, butalso scatter the lightthrough multiple reflections - somelight emerges backthrough surface as diffuse reflection.
![Page 5: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/5.jpg)
13.5Si23_03
Ambient ReflectionAmbient Reflection
In addition to diffuse and specular reflection, a scene will also include ambientambient reflection
This is caused by light falling on an object after reflection off other surfaces– eg in a room with a light above a
table, the floor below the table will not be totally black, despite having no direct illumination - this is reflection of ambient light
![Page 6: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/6.jpg)
13.6Si23_03
Reflection Model - Ambient Light
Reflection Model - Ambient Light
surface
I ( )= Ka ( )Ia()Ia = Intensity of ambient lightKa = Ambient-reflection coefficientI = Reflected intensity= wavelength of light
hemisphereof ambientlight
P
![Page 7: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/7.jpg)
13.7Si23_03
Ambient LightingAmbient Lighting
![Page 8: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/8.jpg)
13.8Si23_03
Reflection Model - Diffuse Reflection
Reflection Model - Diffuse Reflection
Light reflected equally in all directions - intensity dependent on angle between light source and surface normal
Lambert’s cosine law: I = I* cos where I* is intensity of light source
P
lightsource
P
lightsource
lightsourceN
L
surface
![Page 9: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/9.jpg)
13.9Si23_03
Reflection Model - Diffuse Reflection
Reflection Model - Diffuse Reflection
I = Kd ( cos ) I*
I* = Intensity of light sourceN = Surface normalL = Direction of light sourceKd = Diffuse-reflection
coefficientI = Reflected intensity
lightsourceN
L
surface
Light reflected equallyin all directions, withintensity depending onangle between light andsurface normal:
![Page 10: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/10.jpg)
13.10Si23_03
Reflection Model - Diffuse Reflection
Reflection Model - Diffuse Reflection
The angle between two vectors is given by their dot product: cos = L . N (assume L, N are unit length)
The coefficient Kd depends on the wavelength of the incoming light
lightsourceN
L
surface
I ( ) = Kd() ( L . N ) I*()
![Page 11: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/11.jpg)
13.11Si23_03
Ambient and DiffuseAmbient and Diffuse
![Page 12: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/12.jpg)
13.12Si23_03
Reflection Model - Specular ReflectionReflection Model -
Specular Reflection
In perfect specular reflection, light is onlyreflected along the unique direction symmetricto the incoming light
P
lightsource
N
R
![Page 13: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/13.jpg)
13.13Si23_03
Reflection Model - Specular ReflectionReflection Model -
Specular Reflection
P
lightsource
N
R
In practice, light is reflected within a small angle ofthe perfect reflection direction - the intensity of thereflection tails off at the outside of the cone. Thisgives a narrow highlight for shiny surfaces, and abroad highlight for dull surfaces.
![Page 14: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/14.jpg)
13.14Si23_03
Reflection Model - Specular ReflectionReflection Model -
Specular Reflection
Thus we want to model intensity, I, as a function of angle between viewer and R, say , like this:
I
with a sharper peak for shinier surfaces, and broader peakfor dull surfaces.
![Page 15: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/15.jpg)
13.15Si23_03
Reflection Model - Specular ReflectionReflection Model -
Specular Reflection
Phong realised this effect can be modelled by:
(cos )n
with a sharper peak for larger n
I
n=1
n=10
![Page 16: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/16.jpg)
13.16Si23_03
Reflection Model - Specular ReflectionReflection Model -
Specular Reflection
I = Ks( cos )n I*
I* = Intensity of light sourceV = View directionR = Direction of perfect
reflected lightKs = Specular-reflection
coefficientI = Reflected intensity
n varies with materiallarge n : shinysmall n : dull
Intensity depends onangle between eye andreflected light ray:
V
lightsourceN
LR
eye
surface
![Page 17: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/17.jpg)
13.17Si23_03
Reflection Model - Specular ReflectionReflection Model -
Specular Reflection
V
lightsourceN
LR
eye
surface
Using cos = R . V (R, V unit vectors), we have:
I () = Ks ( R . V )n I()*
Note: Ks does not depend on the wavelength - hencecolour of highlight is same as source
Note: intensityforms ‘ellipse’ shape
![Page 18: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/18.jpg)
13.18Si23_03
Ambient, Diffuse and Specular
Ambient, Diffuse and Specular
![Page 19: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/19.jpg)
13.19Si23_03
Reflection Model -Ambient, Diffuse and
Specular
Reflection Model -Ambient, Diffuse and
Specular
lightsource
I() = Ka()Ia() + ( Kd()( L . N ) + Ks( R . V )n ) I*()
N
LR
Veye
surface
![Page 20: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/20.jpg)
13.20Si23_03
Example - Ambient Reflection
Example - Ambient Reflection
![Page 21: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/21.jpg)
13.21Si23_03
Example - Ambient and Diffuse
Example - Ambient and Diffuse
![Page 22: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/22.jpg)
13.22Si23_03
Ambient, Diffuse and Specular
Ambient, Diffuse and Specular
![Page 23: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/23.jpg)
13.23Si23_03
Reflection Model - Effect of Distance
Reflection Model - Effect of Distance
lightsource
surface
d
The intensity of light reaching a surface decreases with distance - so we use typically:
I*
K1 + K2*d + K3*d2K1, K2, K3 constant- often K2=1, K3=0
![Page 24: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/24.jpg)
13.24Si23_03
Final Reflection ModelFinal Reflection Model
lightsourceN
LR
Veye
surfaced
I() = Ka()Ia() + ( Kd()( L . N ) + Ks( R . V )n ) I*()
K1 + K2*d + K3*d2
This needs to be applied for every light source in the scene
![Page 25: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/25.jpg)
13.25Si23_03
Phong illumination model: Ks 0.0 to 1.0, Kd 0.0 to 1.0(Ka = 0.7, n = 10.0)
Ks
Kd
![Page 26: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/26.jpg)
13.26Si23_03
Phong Illumination Model: Ks 0.0 to 1.0; n = 10.0 to 810.0(Ka = 0.7, Kd = 1.0)
n
Ks
![Page 27: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/27.jpg)
13.27Si23_03
Practicalities - Effect of Colour
Practicalities - Effect of Colour
The Phong reflection model gives reflection for each wavelength in visible spectrum
In practice, we assume light to be composed as a mixture of RGB (red, green, blue) components - and reflection model is applied for each component
Coefficients of ambient-reflection (Ka) and diffuse-reflection (Kd) have separate components for RGB
Coefficient of specular-reflection (Ks) is independent of colour in Phong model but ….
![Page 28: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/28.jpg)
13.28Si23_03
Specular Reflection in Reality
Specular Reflection in Reality
Really… specular reflection depends a little bit on:– Angle of incidence of light– Material proerties of surface
Thus OpenGL for example will allow different specular reflection coefficients in R,G, B channels
![Page 29: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/29.jpg)
13.29Si23_03
Practicalities - Effect of Distance
Practicalities - Effect of Distance
There are advantages in assuming light source and viewer are at infinity– L and V are then fixed for whole
scene and calculations become simpler
Lights at infinity are called directionaldirectional lights
Lights at a specified position are called positionalpositional, or point point, lights
![Page 30: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/30.jpg)
13.30Si23_03
Programming Reflection in OpenGL
Programming Reflection in OpenGL
Light sources– Read pp13-14 of
guide– To set position
glLightfv(GL_LIGHT1, GL_POSITION, ptCoords)
– To set colour
glLightfv(GL_LIGHT1, GL_DIFFUSE, rgba_colour)
– Remember to activate lights (glEnable)
Surface Reflection– Read p15 of guide– To set material
property – ie reflection coeffs (at each vertex of model)
glMaterialfv (GL_FRONT, GL_DIFFUSE, myDiffuse)
whereGlfloat myDiffuse[] = {0.8, 0.3, 0.4, 1.0}
![Page 31: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/31.jpg)
13.31Si23_03
Coursework 3Coursework 3
London Eye
![Page 32: 13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model](https://reader035.vdocument.in/reader035/viewer/2022062318/5515f53255034694308b468c/html5/thumbnails/32.jpg)
13.32Si23_03
AcknowledgementsAcknowledgements
Thanks to Alan Watt for the images