DOC PREVIEW
UMD ASTR 680 - Lecture 18: Illumination and Shading 1

This preview shows page 1-2 out of 7 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1Computer Graphics (Fall 2008)Computer Graphics (Fall 2008)COMS 4160, Lecture 18: Illumination and Shading 1http://www.cs.columbia.edu/~cs4160Rendering: 1960s (visibility)Rendering: 1960s (visibility) Roberts (1963), Appel (1967) - hidden-line algorithms Warnock (1969), Watkins (1970) - hidden-surface  Sutherland (1974) - visibility = sortingImages from FvDFH, Pixar’s ShutterbugSlide ideas for history of Rendering courtesy Marc Levoy1970s - raster graphics Gouraud (1971) - diffuse lighting, Phong (1974) - specular lighting Blinn (1974) - curved surfaces, texture Catmull (1974) - Z-buffer hidden-surface algorithmRendering: 1970s (lighting)Rendering: 1970s (lighting)Rendering (1980s, 90s: Global Illumination)Rendering (1980s, 90s: Global Illumination)early 1980s - global illumination  Whitted (1980) - ray tracing Goral, Torrance et al. (1984) radiosity Kajiya (1986) - the rendering equationOutlineOutline Preliminaries Basic diffuse and Phong shading Gouraud, Phong interpolation, smooth shading Formal reflection equationFor today’s lecture, slides and chapter 9 in textbookMotivationMotivation Objects not flat color, perceive shape with appearance Materials interact with lighting Compute correct shading pattern based on lighting This is not the same as shadows (separate topic) Some of today’s lecture review of last OpenGL lec. Idea is to discuss illumination, shading independ. OpenGL Today, initial hacks (1970-1980) Next lecture: formal notation and physics2Linear Relationship of LightLinear Relationship of Light Light energy is simply sum of all contributions Terms can be calculated separately and later added: multiple light sources multiple interactions (diffuse, specular, more later) multiple colors (R-G-B, or per wavelength)∑=kkIIGeneral ConsiderationsGeneral ConsiderationsSurfaces have a position, and a normal at every point.Other vectors used L = vector to the light sourcelight position minus surface point position E = vector to the viewer (eye)viewer position minus surface point position(x1,y1,z1)N1(x2,y2,z2)N2Diffuse Diffuse LambertianLambertianTermTerm Rough matte (technically Lambertian) surfaces Not shiny: matte paint, unfinished wood, paper, … Light reflects equally in all directions Obey Lambert’s cosine law Not exactly obeyed by real materialsINL•∼N-LMeaning of negative dot productsMeaning of negative dot products If (N dot L) is negative, then the light is behind the surface, and cannot illuminate it. If (N dot E) is negative, then the viewer is looking at the underside of the surface and cannot see it’s front-face. In both cases, I is clamped to Zero.PhongPhongIllumination ModelIllumination Model Specular or glossy materials: highlights Polished floors, glossy paint, whiteboards For plastics highlight is color of light source (not object) For metals, highlight depends on surface color Really, (blurred) reflections of light sourceRoughnessIdea of Idea of PhongPhongIlluminationIllumination Find a simple way to create highlights that are view-dependent and happen at about the right place Not physically based Use dot product (cosine) of eye and reflection of light direction about surface normal Alternatively, dot product of half angle and normal Raise cosine lobe to some power to control sharpness3PhongPhongFormulaFormula-LRE()pIRE∼i?R =2( )RLLNN=− + iAlternative: HalfAlternative: Half--Angle (Angle (BlinnBlinn--PhongPhong)) In practice, both diffuse and specular componentsHN()pINH∼iOutlineOutline Preliminaries Basic diffuse and Phong shading Gouraud, Phong interpolation, smooth shading Formal reflection equation Not in text. If interested, look at FvDFH pp 736-738Triangle Meshes as ApproximationsTriangle Meshes as Approximations Most geometric models large collections of triangles. Triangles have 3 vertices with position, color, normal Triangles are approximation to actual object surfaceVertex ShadingVertex Shading We know how to calculate the light intensity given: surface position normal viewer position light source position (or direction) 2 ways for a vertex to get its normal: given when the vertex is defined take normals from faces that share vertex, and averageColoring Inside the PolygonColoring Inside the Polygon How do we shade a triangle between it’s vertices, where we aren’t given the normal? Inter-vertex interpolation can be done in object space (along the face), but it is simpler to do it in image space (along the screen).4Flat vs. Flat vs. GouraudGouraudShadingShadingFlat - Determine that each face has a single normal, and color the entire face a single value, based on that normal.Gouraud – Determine the color at each vertex, using the normal at that vertex, and interpolate linearly for the pixels between the vertex locations.glShadeModel(GL_FLAT) glShadeModel(GL_SMOOTH)GouraudGouraudShading Shading ––DetailsDetailsScan line1I2I3I1y2y3ysyaIbI122112()()ssaIyy IyyIyy−+ −=−133113()()ssbIyy IyyIyy−+ −=−()()ab p bp apbaIxx Ix xIxx−+ −=−pIActual implementation efficient: difference equations while scan convertingGouraudGouraudand Errorsand Errors I1= 0 because (N dot E) is negative. I2= 0 because (N dot L) is negative. Any interpolation of I1and I2will be 0.I1 = 0 I2 = 0area of desired highlight2 2 PhongsPhongsmake a Highlightmake a Highlight Besides the Phong Reflectance model (cosn), there is a PhongShading model. Phong Shading: Instead of interpolating the intensities between vertices, interpolate the normals. The entire lighting calculation is performed for each pixel, based on the interpolated normal. (OpenGL doesn’t do this, but you can with current programmable shaders)I1 = 0 I2 = 0Problems with Interpolated ShadingProblems with Interpolated Shading Silhouettes are still polygonal Interpolation in screen, not object space: perspective distortion Not rotation or orientation-independent How to compute vertex normals for sharply curving surfaces? But at end of day, polygons are mostly preferred to explicitly representing curved objects like spline patches for renderingOutlineOutline Preliminaries Basic diffuse and Phong shading Gouraud, Phong interpolation, smooth shading Formal reflection equation5Motivation• Lots of ad-hoc tricks for shading– Kind of looks right,


View Full Document

UMD ASTR 680 - Lecture 18: Illumination and Shading 1

Download Lecture 18: Illumination and Shading 1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 18: Illumination and Shading 1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 18: Illumination and Shading 1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?