1 / 49

CS 445 / 645 Introduction to Computer Graphics

CS 445 / 645 Introduction to Computer Graphics. Lecture 14 Lighting. Today we talk about lighting. Typical three-step development process Understand the real system – how does light work (Physics) Determine what matters to us – what can we sense (Psyc)

latimer
Télécharger la présentation

CS 445 / 645 Introduction to Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 445 / 645Introduction to Computer Graphics Lecture 14 Lighting

  2. Today we talk about lighting • Typical three-step development process • Understand the real system – how does light work (Physics) • Determine what matters to us – what can we sense (Psyc) • Engineer a system that remains true to the portion of reality we can appreciate

  3. What can we sense?Review of lecture notes about color • What color do we see the best? • Yellow-green at 550 nm • What color do we see the worst? • Blue at 440 nm • How many fully saturated hues can be distinguished? • 128 fully saturated hues • How many saturations can be distinguished for a given hue? • 16 to 23 depending on hue

  4. Engineer a SolutionCIE Color Space • International standard for describing a color (1931) • Empirically determined parameterization (X, Y, Z) • Any pure wavelength  can be matched perceptually by positive combinations of X,Y,Z

  5. Engineer a SolutionCIE Color Space • The gamut of all colors perceivable is thus a three-dimensional shape in X,Y,Z

  6. Engineer a SolutionDevices Have Unique Color Gamuts • Since X, Y, and Z are hypothetical light sources, no real device can produce the entire gamut of perceivable color

  7. Engineer a SolutionRGB Color Space (Color Cube) • Define colors with (r, g, b) amounts of red, green, and blue

  8. Engineer a SolutionRGB Color Gamuts • The RGB color cube sits within CIE color space something like this:

  9. Engineer a SolutionRGB Color Space • RGB may be counter intuitive • Must think about mixing colors • Small changes in RGB value may have large or small perceived color changes

  10. Engineer a SolutionHSV Color Space • A more intuitive color space • HSV is an alternative: • Hue - The color we see (red, green, purple) • Saturation - How far is the color from gray (pink is less saturated than red, sky blue is less saturated than royal blue) • Brightness (Luminance) - How bright is the color (how bright are the lights illuminating the object?)

  11. HSV Color Space • H = Hue • S = Saturation • V = Value (or brightness) Saturation Value Hue

  12. Solving the Lighting Problem • We somewhat understand the perception of light (color) • We engineered a solution to representing and generating color using computers • We need to understand the interplay of light and objects

  13. Optical Illusion

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

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

  16. Definitions • Illumination: the transport of energy from light sources to surfaces & points • Note: includes directand indirectillumination Images by Henrik Wann Jensen

  17. Definitions • Lighting: the process of computing the luminous intensity (i.e., outgoing light) at a particular 3-D point, usually on a surface • Shading: the process of assigning colors to pixels(why the distinction?)

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

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

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

  21. Simplifications for Interactive Graphics • Only directillumination from emitters to surfaces • Simplify geometry of emitters to trivial cases

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

  23. Ambient Light Sources • For each sampled wavelength (R, G, B), the ambient light reflected from a surface depends on • The surface properties,kambient • The intensity, Iambient,of the ambient light source (constant for all points on all surfaces ) • Ireflected = kambient Iambient

  24. Ambient Light Sources • A scene lit only with an ambient light source: Light PositionNot Important Viewer PositionNot Important Surface AngleNot Important

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

  26. Directional Light Sources • The same scene lit with a directional and an ambient light source Light PositionNot Important Surface AngleImportant Viewer PositionNot Important

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

  28. Point Light Sources • Using an ambient and a point light source: Light PositionImportant Viewer PositionImportant Surface AngleImportant

  29. Other Light Sources • Spotlights are point sources whose intensity falls off directionally. • Requires color, pointdirection, falloffparameters • Supported by OpenGL

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

  31. The Physics of Reflection • Ideal diffuse reflection • An ideal diffuse reflector, at the microscopic level, is a very rough surface (real-world example: chalk) • Because of these microscopic variations, an incoming ray of light is equally likely to be reflected in any direction over the hemisphere: • What does the reflected intensity depend on?

  32. Lambert’s Cosine Law • Ideal diffuse surfaces reflect according to Lambert’s cosine law: The energy reflected by a small portion of a surface from a light source in a given direction is proportional to the cosine of the angle between that direction and the surface normal • These are often called Lambertian surfaces • Note that the reflected intensity is independent of the viewing direction, but does depend on the surface orientation with regard to the light source

  33. Lambert’s Law

  34. Computing Diffuse Reflection • The angle between the surface normal and the incoming light is the angle of incidence: • Idiffuse = kd Ilightcos  • In practice we use vector arithmetic: • Idiffuse = kd Ilight (n • l) l n 

  35. Diffuse Lighting Examples • We need only consider angles from 0° to 90° (Why?) • A Lambertian sphere seen at several different lighting angles:

  36. Specular Reflection • Shiny surfaces exhibit specular reflection • Polished metal • Glossy car finish • A light shining on a specular surface causes a bright spot known as a specular highlight • Where these highlights appear is a function of the viewer’s position, so specular reflectance is view dependent

  37. The Physics of Reflection • At the microscopic level a specular reflecting surface is very smooth • Thus rays of light are likely to bounce off the microgeometry in a mirror-like fashion • The smoother the surface, the closer it becomes to a perfect mirror

  38. The Optics of Reflection • Reflection follows Snell’s Laws: • The incoming ray and reflected ray lie in a plane with the surface normal • The angle that the reflected ray forms with the surface normal equals the angle formed by the incoming ray and the surface normal: (l)ight = (r)eflection

  39. Non-Ideal Specular Reflectance • Snell’s law applies to perfect mirror-like surfaces, but aside from mirrors (and chrome) few surfaces exhibit perfect specularity • How can we capture the “softer” reflections of surface that are glossy rather than mirror-like? • One option: model the microgeometry of the surface and explicitly bounce rays off of it • Or…

  40. Non-Ideal Specular Reflectance: An Empirical Approximation • In general, we expect most reflected light to travel in direction predicted by Snell’s Law • But because of microscopic surface variations, some light may be reflected in a direction slightly off the ideal reflected ray • As the angle from the ideal reflected ray increases, we expect less light to be reflected

  41. Non-Ideal Specular Reflectance: An Empirical Approximation • An illustration of this angular falloff: • How might we model this falloff?

  42. Phong Lighting • The most common lighting model in computer graphics was suggested by Phong: v • The nshinyterm is a purelyempirical constant that varies the rate of falloff • Though this model has no physical basis, it works (sort of) in practice

  43. Phong Lighting: The nshinyTerm • This diagram shows how the Phong reflectance term drops off with divergence of the viewing angle from the ideal reflected ray: • What does this term control, visually? Viewing angle – reflected angle

  44. Calculating Phong Lighting • The cos term of Phong lighting can be computed using vector arithmetic: • V is the unit vector towards the viewer • Ris the ideal reflectance direction • An aside: we can efficiently calculate r? v

  45. Calculating The R Vector • This is illustrated below:

  46. Phong Examples • These spheres illustrate the Phong model as l and nshiny are varied:

  47. The Phong Lighting Model • Let’s combine ambient, diffuse, and specular components: • Commonly called Phong lighting • Note: once per light • Note: once per color component • Do ka, kd, and ks vary with color component?

  48. Phong Lighting: Intensity Plots

  49. Lighting Review • Lighting Models • Ambient • Normals don’t matter • Lambert/Diffuse • Angle between surface normal and light • Phong/Specular • Surface normal, light, and viewpoint • Next Class, Shading Models…

More Related