Download presentation

Presentation is loading. Please wait.

Published byKimberly Orr Modified over 2 years ago

1
13.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 13 – Simple Reflection Model

2
13.2 Si23_03 What is a Reflection Model? reflection modellighting illumination n A reflection model (also called lighting or illumination model) describes the interaction between light and a surface, in terms of: – surface properties – nature of incident light n Computer graphics uses a simplification of accurate physical models – objective is to mimic reality to an acceptable degree

3
13.3 Si23_03 Phong Reflection Model n The most common reflection model in computer graphics is due to Phong Bui- tuong - in 1975 n Has proved an acceptable compromise between simplicity and accuracy n Largely empirical n It is a local reflection model – does not handle global effects of light reflecting between surfaces – Ray tracing and radiosity methods will handle this

4
13.4 Si23_03 Diffuse Reflection and Specular Reflection - Phong Approach microscopic view white light specular reflection (white) diffuse reflection (yellow) yellow pigment particles Some light reflected directly from surface. Other light passes into material. Particles of pigment absorb certain wavelengths from the incident light, but also scatter the light through multiple reflections - some light emerges back through surface as diffuse reflection.

5
13.5 Si23_03 Ambient Reflection ambient n In addition to diffuse and specular reflection, a scene will also include ambient reflection n 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

6
13.6 Si23_03 Reflection Model - Ambient Light surface I ( )= K a ( )I a ( ) I a = Intensity of ambient light K a = Ambient-reflection coefficient I = Reflected intensity = wavelength of light hemisphere of ambient light P

7
13.7 Si23_03 Ambient Lighting

8
13.8 Si23_03 Reflection Model - Diffuse Reflection Light reflected equally in all directions - intensity dependent on angle between light source and surface normal Lamberts cosine law: I = I* cos where I* is intensity of light source P light source P light source light source N L surface

9
13.9 Si23_03 Reflection Model - Diffuse Reflection I = K d ( cos ) I* I* = Intensity of light source N = Surface normal L = Direction of light source K d = Diffuse-reflection coefficient I = Reflected intensity light source N L surface Light reflected equally in all directions, with intensity depending on angle between light and surface normal:

10
13.10 Si23_03 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 K d depends on the wavelength of the incoming light light source N L surface I ( ) = K d ( ) ( L. N ) I*( )

11
13.11 Si23_03 Ambient and Diffuse

12
13.12 Si23_03 Reflection Model - Specular Reflection In perfect specular reflection, light is only reflected along the unique direction symmetric to the incoming light P light source N R

13
13.13 Si23_03 Reflection Model - Specular Reflection P light source N R In practice, light is reflected within a small angle of the perfect reflection direction - the intensity of the reflection tails off at the outside of the cone. This gives a narrow highlight for shiny surfaces, and a broad highlight for dull surfaces.

14
13.14 Si23_03 Reflection 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 peak for dull surfaces.

15
13.15 Si23_03 Reflection Model - Specular Reflection n Phong realised this effect can be modelled by: (cos ) n with a sharper peak for larger n I n=1 n=10

16
13.16 Si23_03 Reflection Model - Specular Reflection I = K s ( cos ) n I* I* = Intensity of light source V = View direction R = Direction of perfect reflected light K s = Specular-reflection coefficient I = Reflected intensity n varies with material large n : shiny small n : dull Intensity depends on angle between eye and reflected light ray: V light source N L R eye surface

17
13.17 Si23_03 Reflection Model - Specular Reflection V light source N L R eye surface Using cos = R. V (R, V unit vectors), we have: I ( ) = K s ( R. V ) n I( )* Note: K s does not depend on the wavelength - hence colour of highlight is same as source Note: intensity forms ellipse shape

18
13.18 Si23_03 Ambient, Diffuse and Specular

19
13.19 Si23_03 Reflection Model - Ambient, Diffuse and Specular Reflection Model - Ambient, Diffuse and Specular light source I( ) = K a ( )I a ( ) + ( K d ( )( L. N ) + K s ( R. V ) n ) I*( ) N L R V eye surface

20
13.20 Si23_03 Example - Ambient Reflection

21
13.21 Si23_03 Example - Ambient and Diffuse

22
13.22 Si23_03 Ambient, Diffuse and Specular

23
13.23 Si23_03 Reflection Model - Effect of Distance light source surface d The intensity of light reaching a surface decreases with distance - so we use typically: I* K 1 + K 2 *d + K 3 *d 2 K 1, K 2, K 3 constant - often K 2 =1, K 3 =0

24
13.24 Si23_03 Final Reflection Model light source N L R V eye surface d I( ) = K a ( )I a ( ) + ( K d ( )( L. N ) + K s ( R. V ) n ) I*( ) K 1 + K 2 *d + K 3 *d 2 This needs to be applied for every light source in the scene

25
13.25 Si23_03 Phong illumination model: Ks 0.0 to 1.0, Kd 0.0 to 1.0 (Ka = 0.7, n = 10.0) Ks Kd

26
13.26 Si23_03 Phong Illumination Model: Ks 0.0 to 1.0; n = 10.0 to (Ka = 0.7, Kd = 1.0) n Ks

27
13.27 Si23_03 Practicalities - Effect of Colour The Phong reflection model gives reflection for each wavelength in visible spectrum n 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 n Coefficients of ambient-reflection (K a ) and diffuse-reflection (K d ) have separate components for RGB n Coefficient of specular-reflection (K s ) is independent of colour in Phong model but ….

28
13.28 Si23_03 Specular Reflection in Reality n Really… specular reflection depends a little bit on: – Angle of incidence of light – Material proerties of surface n Thus OpenGL for example will allow different specular reflection coefficients in R,G, B channels

29
13.29 Si23_03 Practicalities - Effect of Distance n 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 directional n Lights at infinity are called directional lights positional point n Lights at a specified position are called positional, or point, lights

30
13.30 Si23_03 Programming Reflection in OpenGL n 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 ) n Surface Reflection – Read p15 of guide – To set material property – ie reflection coeffs (at each vertex of model) glMaterialfv (GL_FRONT, GL_DIFFUSE, myDiffuse) where Glfloat myDiffuse[] = {0.8, 0.3, 0.4, 1.0}

31
13.31 Si23_03 Coursework 3 n London Eye

32
13.32 Si23_03 Acknowledgements n Thanks to Alan Watt for the images

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google