#11: LightingCSE167: Computer GraphicsInstructor: Ronen BarzelUCSD, Winter 20061Outline for todayOverview of lighting Notes on color Local Illumination Light Sources Shading Advanced Lighting2Where we are so far… We know how to rasterize: Given a 3D triangle (or a bunch of triangles) Given a 3D camera… …we know which pixels represent the triangles But what color should those pixels be?3Lighting(non-teapot images by Henrik Wann Jensen)4Lighting To create a photorealistic image: Simulate the interaction of light with the objects in the scene Simulate the interaction of light with the eye or camera I.e., simulation of physics and optics• Advanced rendering course (CSE168)• Many aspects “solved” in principle but still an area of active research• Very slow to compute fully• Use global illumination techniques: examine the whole scene at once• Known as physically-based rendering For interactive computer graphics: Use a simplified model for speed Empirical/perceptual -- approximate interesting observed phenomena Use local illumination techniques:• only direct effect of lights on surfaces5Basic Components of LightingLight sources AKA emitters Color and intensity Geometric attributes: Position, Direction, Shape Spatial attenuation Advanced properties: Spectrum, Polarization, …Surfaces Geometric attributes: Position, OrientationMaterial properties: reflectance• color• shininess, glossiness, …• texture• Advanced: translucency, microstructure, sub-surface scattering, …6Lighting vs. ShadingLighting: compute the result of light illuminating surfacesShading: assign colors to pixels For photorealistic rendering: in principle, shading==lighting: perform lighting at every pixel In practice: may take shortcuts may include non-lighting effects• fog• illustration• cartoon shading7Vertex Lighting Each vertex goes through lighting process Lighting computation determines final color at the vertex Based on initial “unlit” vertex color Based on lights in the scene Based on material properties of the surface Based on surface normal Interpolate colors using Gouraud shading (Same lighting computation for per-pixel lighting) !n8Outline for today Overview of lightingNotes on color Local Illumination Light Sources Shading Advanced Lighting9What is light? What is color? Light is electromagnetic energy a continuous range of wavelengths varying intensity at each wavelength Color is a property of the visual system Not an inherent property of light Human eyes have Red, Green, Blue receptors (cones)• Each receptor responds to a range of wavelengths• Gives rise to “primary colors”:• all colors expressed as combination of red, green, blue cone stimulation• Lots of perceptual, psychophysical effects:• adaptation, inhibition, illusion Physically correct computation requires computing interactions at all wavelengths Perceptually correct computation Requires taking into account psychophysics Pretty good approximation: Separate light into red, green, blue components Process each component independently10Color illusion The squares marked A and B are the same shade of gray11Color Illusion -- proof12Color Spaces13Material Colors Inherent “material color” which is the color that the objectreflects Material reflects different wavelengths of light different amounts In RGB, have a reflectivity amount for each of red, green, blue An object can’t reflect more light than it receives Maximum: reflect 100% of light in all wavelengths--bright white Reasonable: reflect 95% of light, material color =(0.95, 0.95, 0.95) Material colors range from 0.0 to 1.0 in RGB14Light Color No limit to total light intensity reflecting from surface Can make individual light source brighter Can add more lights Represent a light source using intensity in RGB Range from 0.0 up There is no upper limit to the intensity of light In other words, a bright white light might have color (10,10,10) Units? physically-based rendering: photon power flux density in practice: arbitrary units (“my light goes up to 11”)15Color & Intensity Distinction between material color and light color: Material colors represent the proportion of light reflected Light colors represent the actual intensity of a beam of light We never perceive the inherent material color All we see is the light reflected off of a material Shine a red light…• on a white or red surface: the object appears red• on a grey surface: the object appears dark red• on a blue surface: the object appears black16Exposure and Display What do we mean by “white”? Human eyes (and digital cameras) adjust exposure settings automatically In a moderatly lit room, intensity 0.5 might appear as white In bright sunlight, intensity 100 might appear as (same) white The monitor has an upper limit to the brightness it can display RGB units: 0=no light at the pixel, 1=full intensity at the pixel exact color light that emerges depends on monitor properties• brightness, contrast, white point, color balance, … Final result of lighting calculation shouldn’t be more than 1.0 Advanced techniques: exposure control, AKA “tone mapping” In practice: Assume intensity (1,1,1) is white clamp all final color values to 0.0-1.0 range before storing in pixel17Outline for today Overview of lighting Notes on colorLocal Illumination Light Sources Shading Advanced Lighting18Local Illumination AKA Local Lighting Models Light on a point on the surface (vertex) Assume we have an incident ray of light Light coming from a known direction With a given RGB color (intensity) We will build up empirical material properties Fancy name: Bidirectional Reflectance Distribution Function“BRDF”19Reflectivity White sheet of paper might reflect 95% of incident light A mirror might reflect 95% of incedent light Yet, these two things look completely different: They reflect light in different directions The paper is a diffuse reflector The mirror is a specular reflector20“Standard” Lighting Model Consists of three terms linearlycombined:Diffuse component for the amount ofincoming light reflected equally in
View Full Document