DOC PREVIEW
UW-Madison CS 559 - CS 559 Lecture Notes

This preview shows page 1-2-16-17-18-33-34 out of 34 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 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 34 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 34 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 34 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 34 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 34 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 34 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Last Time BSP Tree rendering and exact visibility in mazes Local Shading Diffuse term Specular term 03 19 2002 c University of Wisconsin CS 559 Today Shading Interpolation OpenGL and lighting shading More on light sources Texture Mapping 03 19 2002 c University of Wisconsin CS 559 Next Time Midterm In class One sheet of paper double sided Anything on the to know sheet is possible Last office hour for me before exam is this afternoon 03 19 2002 c University of Wisconsin CS 559 Putting It Together I ka I a I i kd L N k s H N n Global ambient intensity Ia Gross approximation to light bouncing around of all other surfaces Modulated by ambient reflectance ka Just sum all the terms If there are multiple lights sum contributions from each light Several variations and approximations 03 19 2002 c University of Wisconsin CS 559 Color I r ka r I a r I i r kd r L N k s r H N n Do everything for three colors r g and b r is shown Note that some terms the expensive ones are constant For reasons we will not go into this is an approximation but few graphics practitioners realize it Aliasing in color space Better results use 9 color samples 03 19 2002 c University of Wisconsin CS 559 Distant Light Approximation The viewer direction V and the light direction L depend on the surface position being considered x Distant light approximation Assume L is constant for all x Good approximation if light is distant such as sun Generally called a directional light source What aspects of surface appearance are affected by this approximation Diffuse Specular 03 19 2002 c University of Wisconsin CS 559 Local Viewer Approximation Specularities require the viewing direction V x c x Slightly expensive to compute Local viewer approximation uses a global V Independent of which point is being lit Use the view plane normal vector Error depends on the nature of the scene Is the diffuse component affected 03 19 2002 c University of Wisconsin CS 559 Describing Surfaces The various parameters in the lighting equation describe the appearance of a surface kd r kd g kd b The diffuse color which most closely maps to what you would consider the color of a surface Also called diffuse reflectance coefficient ks r ks g ks b The specular color which controls the color of specularities The same as the diffuse color for metals white for plastics Some systems do not let you specify this color separately ka r ka g ka b The ambient color which controls how the surface looks when not directly lit Normally the same as the diffuse color 03 19 2002 c University of Wisconsin CS 559 OpenGL Model Allows emission E Light being emitted by surface Allows separate light intensity for diffuse and specular Ambient light can be associated with light sources Allows spotlights that have intensity that depends on outgoing light direction Allows attenuation of light intensity with distance Can specify coefficients in multiple ways Too many variables and commands to present in class The OpenGL programming guide goes through it all the red book 03 19 2002 c University of Wisconsin CS 559 OpenGL Commands 1 glMaterial if face parameter value Changes one of the coefficients for the front or back side of a face or both sides glLight if light property value Changes one of the properties of a light intensities positions directions etc There are 8 lights GL LIGHT0 GL LIGHT1 glLightModel if property value Changes one of the global light model properties global ambient light for instance glEnable GL LIGHT0 enables GL LIGHT0 You must enable lights before they contribute to the image You can enable and disable lights at any time 03 19 2002 c University of Wisconsin CS 559 OpenGL Commands 2 glColorMaterial face mode Causes a material property such as diffuse color to track the current glColor Speeds things up and makes coding easier glEnable GL LIGHTING turns on lighting You must enable lighting explicitly it is off by default Don t use specular intensity if you don t have to It s expensive turn it off by giving 0 0 0 as specular color of the lights Don t forget normals Many other things to control appearance 03 19 2002 c University of Wisconsin CS 559 Shading Interpolation The models we have discussed give the intensity of a single point Computing these models for every point that is displayed is expensive Normals may not be explicitly stated for every point Several options Flat shading Gouraud interpolation Phong interpolation New hardware provides other options 03 19 2002 c University of Wisconsin CS 559 Flat shading Compute shading at a representative point and apply to whole polygon OpenGL uses one of the vertices Advantages Fast one shading computation per polygon Disadvantages Inaccurate What are the artifacts 03 19 2002 c University of Wisconsin CS 559 Gourand Shading Shade each vertex with it s own location and normal Linearly interpolate the color across the face Advantages Fast incremental calculations when rasterizing Much smoother use one normal per shared vertex to get continuity between faces Disadvantages What are the artifacts Is it accurate 03 19 2002 c University of Wisconsin CS 559 Phong Interpolation Interpolate normals across faces Shade each pixel Advantages High quality narrow specularities Disadvantages Expensive Still an approximation for most surfaces Not to be confused with Phong s specularity model 03 19 2002 c University of Wisconsin CS 559 03 19 2002 c University of Wisconsin CS 559 Shading and OpenGL OpenGL defines two particular shading models Controls how colors are assigned to pixels glShadeModel GL SMOOTH interpolates between the colors at the vertices the default glShadeModel GL FLAT uses a constant color across the polygon 03 19 2002 c University of Wisconsin CS 559 The Current Generation Current hardware allows you to break from the standard illumination model Programmable Vertex Shaders allow you to write a small program that determines how the color of a vertex is computed Your program has access to the surface normal and position plus anything else you care to give it like the light You can add subtract take dot products and so on 03 19 2002 c University of Wisconsin CS 559 The Full Story We have only touched on the complexities of illuminating surfaces The common model is hopelessly inadequate for accurate lighting but it s fast and simple Consider two sub problems of illumination Where does the light go Light transport What happens at surfaces Reflectance models Other algorithms address the transport or the reflectance


View Full Document

UW-Madison CS 559 - CS 559 Lecture Notes

Documents in this Course
Filters

Filters

14 pages

Lecture 2

Lecture 2

24 pages

Clipping

Clipping

22 pages

Modeling

Modeling

33 pages

Filters

Filters

26 pages

Dithering

Dithering

33 pages

Lecture 4

Lecture 4

20 pages

Load more
Download CS 559 Lecture Notes
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 CS 559 Lecture Notes 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 CS 559 Lecture Notes 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?