computer graphics course computer graphics course 2006
play

Computer Graphics Course Computer Graphics Course 2006 2006 Basic - PowerPoint PPT Presentation

Computer Graphics Course Computer Graphics Course 2006 2006 Basic Lighting and Shading Basic Lighting and Shading Based on slides by: Based on slides by: David Brogan David Brogan Raanan Fattal Raanan Fattal Ravi Ravi Rammamoorthi


  1. Computer Graphics Course Computer Graphics Course 2006 2006 Basic Lighting and Shading Basic Lighting and Shading Based on slides by: Based on slides by: David Brogan David Brogan Raanan Fattal Raanan Fattal Ravi Ravi Rammamoorthi Rammamoorthi

  2. Introduction Introduction Remember, we know how to rasterize rasterize Remember, we know how to – Given a 3 Given a 3- -D triangle and a 3 D triangle and a 3- -D viewpoint, we D viewpoint, we – know which pixels represent the triangle know which pixels represent the triangle But what color should those pixels be? But what color should those pixels be?

  3. Introduction Introduction If we’ ’re attempting to create a realistic re attempting to create a realistic If we image, we need to simulate the lighting lighting of of image, we need to simulate the the surfaces in the scene the surfaces in the scene – Fundamentally simulation of Fundamentally simulation of physics physics and and optics optics – – As you As you’ ’ll see, we use a lot of approximations ll see, we use a lot of approximations – (a.k.a a.k.a perceptually based hacks) to do this perceptually based hacks) to do this ( simulation fast enough simulation fast enough

  4. Definitions Definitions Illumination : the transport of energy from : the transport of energy from Illumination light sources to surfaces & points light sources to surfaces & points – Note: includes Note: includes direct direct and and indirect indirect illumination illumination – Images by Henrik Wann Jensen

  5. Definitions Definitions Irradiance Irradiance Light falling on an object has a direction and Light falling on an object has a direction and intensity. intensity. Radiance Radiance Light then interacts with the object and is emitted Light then interacts with the object and is emitted with a new direction(s) and intensity. with a new direction(s) and intensity.

  6. Definitions Definitions Lighting : : Lighting – the process of computing the luminous intensity the process of computing the luminous intensity – (i.e., outgoing light) at a particular 3- -D point, D point, (i.e., outgoing light) at a particular 3 usually on a surface usually on a surface Shading : : Shading – Shading does not mean calculating shadows. Shading does not mean calculating shadows. – – the process of assigning colors to pixels the process of assigning colors to pixels – (why the distinction?) (why the distinction?)

  7. Definitions Definitions Illumination models fall into two categories : Illumination models fall into two categories : – Empirical Empirical : simple formulations that approximate : simple formulations that approximate – observed phenomenon observed phenomenon – Physically based Physically based : models based on the actual physics : models based on the actual physics – of light interacting with matter of light interacting with matter We mostly use empirical models in We mostly use empirical models in interactive graphics for simplicity interactive graphics for simplicity Increasingly, realistic graphics are using Increasingly, realistic graphics are using physically based models physically based models

  8. Components of Illumination Components of Illumination Two components of illumination: light light Two components of illumination: sources and and surface properties surface properties sources Light sources (or emitters emitters ) ) Light sources (or – Spectrum of – Spectrum of emittance emittance (i.e., color of the light) (i.e., color of the light) – Geometric attributes – Geometric attributes Position Position Direction Direction Shape Shape – Directional attenuation Directional attenuation – – More More… … –

  9. Components of Illumination Components of Illumination Surface properties Surface properties – Reflectance spectrum (i.e., color of the surface) Reflectance spectrum (i.e., color of the surface) – – Subsurface reflectance Subsurface reflectance – – Geometric attributes Geometric attributes – Position Position Orientation Orientation Micro- -structure structure Micro

  10. Simplifications for Interactive Simplifications for Interactive Graphics Graphics – Only Only direct direct illumination illumination from emitters to surfaces from emitters to surfaces – – Simplify geometry of emitters to trivial cases Simplify geometry of emitters to trivial cases –

  11. Linear Relationship of Light Linear Relationship of Light Light energy is simply the sum of all the Light energy is simply the sum of all the contributions contributions = ∑ I I k k Terms that can be calculated separately Terms that can be calculated separately and later added together: and later added together: – multiple light sources multiple light sources – – multiple interactions multiple interactions (diffuse, – (diffuse, specular specular, more later) , more later) – multiple colors (R multiple colors (R- -G G- -B, or per wavelength) B, or per wavelength) –

  12. Ambient Light Sources Ambient Light Sources Objects not directly lit are typically still visible Objects not directly lit are typically still visible – e.g., the ceiling in this room, undersides of desks – e.g., the ceiling in this room, undersides of desks This is the result of indirect illumination indirect illumination from from This is the result of emitters, bouncing off intermediate surfaces emitters, bouncing off intermediate surfaces Too expensive to calculate (in real time), so we Too expensive to calculate (in real time), so we use a hack called an ambient light source ambient light source use a hack called an – No spatial or directional characteristics; illuminates all No spatial or directional characteristics; illuminates all – surfaces equally surfaces equally – Amount reflected depends on surface properties Amount reflected depends on surface properties –

  13. Ambient Light Sources Ambient Light Sources For each sampled wavelength (R, G, B), For each sampled wavelength (R, G, B), the ambient light reflected from a surface the ambient light reflected from a surface depends on depends on – The surface properties, The surface properties, k k ambient – ambient – The intensity, The intensity, I I ambient of the ambient light source – , of the ambient light source ambient, (constant for all points on all surfaces ) (constant for all points on all surfaces ) I reflected = k k ambient I ambient I reflected = ambient I ambient

  14. Ambient Light Sources Ambient Light Sources A scene lit only with an ambient light A scene lit only with an ambient light source: source: Light Position Not Important Viewer Position Not Important Surface Angle Not Important

  15. Directional Light Sources Directional Light Sources For a directional light source directional light source we make we make For a simplifying assumptions simplifying assumptions – Direction is constant for all surfaces in the scene Direction is constant for all surfaces in the scene – – All rays of light from the source are parallel All rays of light from the source are parallel – As if the source were infinitely far away As if the source were infinitely far away from the surfaces in the scene from the surfaces in the scene A good approximation to sunlight A good approximation to sunlight The direction from a surface to the light source is The direction from a surface to the light source is important in lighting the surface important in lighting the surface

  16. Point Light Sources Point Light Sources A point light source point light source emits light equally in emits light equally in A all directions from a single point all directions from a single point The direction to the light from a point on a The direction to the light from a point on a surface thus differs for different points: surface thus differs for different points: l – So we need to calculate a So we need to calculate a – normalized vector to the light normalized vector to the light source for every point we light: source for every point we light: p

  17. Point Light Sources Point Light Sources Using an ambient and a point light source: Using an ambient and a point light source: Light Position Important Viewer Position Important Surface Angle Important

  18. Other Light Sources Other Light Sources Spotlights are point sources whose are point sources whose Spotlights intensity falls off directionally. intensity falls off directionally. – Requires color, point Requires color, point – direction, falloff direction, falloff parameters parameters – BTW:Supported BTW:Supported by by – OpenGL OpenGL

  19. Other Light Sources Other Light Sources Area light sources define a 2 define a 2- -D emissive D emissive Area light sources surface (usually a disc or polygon) surface (usually a disc or polygon) – Good example: fluorescent light panels Good example: fluorescent light panels – – Capable of generating Capable of generating soft shadows soft shadows ( ( why? why? ) ) –

Recommend


More recommend