correction news news midterm grading
play

Correction/News News Midterm Grading CPSC 314 Computer Graphics - PowerPoint PPT Presentation

University of British Columbia Correction/News News Midterm Grading CPSC 314 Computer Graphics Homework 2 was posted Wed midterms returned Jan-Apr 2007 due Fri Mar 2 project 2 out Tamara Munzner Project 2 out today


  1. University of British Columbia Correction/News News Midterm Grading CPSC 314 Computer Graphics • Homework 2 was posted Wed • midterms returned Jan-Apr 2007 • due Fri Mar 2 • project 2 out Tamara Munzner • Project 2 out today • due Mon Mar 5 Lighting/Shading II Week 6, Fri Feb 16 http://www.ugrad.cs.ubc.ca/~cs314/Vjan2007 2 3 4 Project 2: Navigation Roll/Pitch/Yaw • five ways to navigate • Absolute Rotate/Translate Keyboard • Absolute Lookat Keyboard • move wrt global coordinate system • Relative Rolling Ball Mouse • spin around with mouse, as discussed in class • Relative Flying • Relative Mouselook • use both mouse and keyboard, move wrt camera • template: colored ground plane 5 6 7 8 Demo Hints: Viewing Hint: Incremental Relative Motion Caution: OpenGL Matrix Storage • motion is wrt current camera coords • don’t forget to flip y coordinate from mouse • OpenGL internal matrix storage is • maintaining cumulative angles wrt world coords would be columnwise, not rowwise • window system origin upper left difficult • computation in coord system used to draw previous frame a e i m • OpenGL origin lower left (what you see!) is simple b f j n • at time k, want p' = I k I k-1 ….I 5 I 4 I 3 I 2 I 1 Cp • thus you want to premultiply: p’=ICp • all viewing transformations belong in c g k o • but postmultiplying by new matrix gives p’=CIp modelview matrix, not projection matrix • OpenGL modelview matrix has the info! sneaky trick: d h l p • dump out modelview matrix with glGetDoublev() • opposite of standard C/C++/Java convention • wipe the stack with glIdentity() • apply incremental update matrix • possibly confusing if you look at the matrix • apply current camera coord matrix from glGetDoublev()! • be careful to leave the modelview matrix unchanged after your display call (using push/pop) 9 10 11 12 Review: Computing Barycentric Reading for Wed/Today/Next Time Review: Light Sources Coordinates ( α , β , γ ( α , β , γ ) = ) = • directional/parallel lights • FCG Chap 9 Surface Shading • 2D triangle area P (1,0,0) (1,0,0) 1 • point at infinity: (x,y,z,0) T • half of parallelogram area • RB Chap Lighting • from cross product ( α , β , γ ( α , β , γ ) = ) = A = Α P1 + Α P2 + Α P3 A • point lights (0,0,1) (0,0,1) P A 2 P P • finite position: (x,y,z,1) T 3 3 Lighting I A P P 1 α = Α P1 /A P • spotlights ( ( α , β , γ α , β , γ ) = ) = 2 (0,1,0) (0,1,0) • position, direction, angle β = Α P2 /A • ambient lights weighted combination of three points γ = Α P3 /A [demo] 13 14 15 16

  2. Light Source Placement Types of Reflection Types of Reflection Reflectance Distribution Model • geometry: positions and directions • specular (a.k.a. mirror or regular ) reflection causes • retro-reflection occurs when incident energy • most surfaces exhibit complex reflectances light to propagate without scattering. • standard: world coordinate system reflects in directions close to the incident • vary with incident and reflected directions. • effect: lights fixed wrt world geometry direction, for a wide range of incident • model with combination • demo: directions. • diffuse reflection sends light in all directions with http://www.xmission.com/~nate/tutors.html equal energy. + + = • alternative: camera coordinate system • gloss is the property of a material surface • effect: lights attached to camera (car headlights) that involves mixed reflection and is • points and directions undergo normal • mixed reflection is a weighted specular + glossy + diffuse = responsible for the mirror like appearance of model/view transformation combination of specular and diffuse. reflectance distribution rough surfaces. • illumination calculations: camera coords 17 18 19 20 Surface Roughness Surface Roughness Physics of Diffuse Reflection Lambert’s Cosine Law • ideal diffuse reflection • at a microscopic scale, all • ideal diffuse surface reflection real surfaces are rough • very rough surface at the microscopic level the energy reflected by a small portion of a surface from a • real-world example: chalk • notice another effect of roughness: light source in a given direction is proportional to the cosine • microscopic variations mean incoming ray of • cast shadows on • each “microfacet” is treated as a perfect mirror. of the angle between that direction and the surface normal light equally likely to be reflected in any • incident light reflected in different directions by themselves • reflected intensity different facets. direction over the hemisphere • independent of viewing direction shadow shadow • end result is mixed reflectance. • what does the reflected intensity depend on? • depends on surface orientation wrt light • “mask” reflected light: • smoother surfaces are more specular or glossy. • often called Lambertian surfaces • random distribution of facet normals results in diffuse reflectance. Masked Light 21 22 23 24 Lambert’s Law Computing Diffuse Reflection Diffuse Lighting Examples Specular Reflection • depends on angle of incidence: angle between surface • Lambertian sphere from several lighting • shiny surfaces exhibit specular reflection normal and incoming light angles: • polished metal l n • I diffuse = k d I light cos θ • glossy car finish diffuse diffuse • in practice use vector arithmetic θ plus • I diffuse = k d I light (n • l) specular • always normalize vectors used in lighting!!! • specular highlight • n, l should be unit vectors • need only consider angles from 0° to 90° • bright spot from light shining on a specular surface intuitively: cross-sectional area of the “beam” intersecting an element • [demo] Brown exploratory on reflection • view dependent • scalar (B/W intensity) or 3-tuple or 4-tuple (color) of surface area is smaller for greater • k d : diffuse coefficient, surface color • http://www.cs.brown.edu/exploratories/freeSoftware/repository/edu/brown/cs/ • highlight position is function of the viewer’s position angles with the normal. exploratories/applets/reflection2D/reflection_2d_java_browser.html • I light : incoming light intensity • I diffuse : outgoing light intensity (for diffuse reflection) 25 26 27 28 Specular Highlights Physics of Specular Reflection Optics of Reflection Non-Ideal Specular Reflectance • at the microscopic level a specular reflecting • reflection follows Snell’s Law: • Snell’s law applies to perfect mirror-like surfaces, but aside from mirrors (and chrome) few surfaces surface is very smooth • incoming ray and reflected ray lie in a plane exhibit perfect specularity with the surface normal • how can we capture the “softer” reflections of • angle the reflected ray forms with surface • thus rays of light are likely to bounce off the surface that are glossy, not mirror-like? normal equals angle formed by incoming ray microgeometry in a mirror-like fashion • one option: model the microgeometry of the and surface normal surface and explicitly bounce rays off of it • or… • the smoother the surface, the closer it becomes to a perfect mirror θ (l)ight = θ (r)eflection Michiel van de Panne 29 30 31 32

Recommend


More recommend