Schedule Update GP 4 – Tesselation/Cg GDS 4 – Subdiv Surf. GP 5 – Object Modeling Lab: Mini-proj Setup GDS 5 – Maya Modeling MCG 6 – Intersections GP 6 – Raytracing Lab: Mini-proj DUE GDS 6/7 – Raytracing Lab: Your object GP 7 – Texture Mapping GDS 8/9 – Textures + Non-realistic Texturing GP 8 – Viewing transforms GDS 10 – Cameras and Framing GP 9 – Real-Time G.I. GDS 11 – Global Illumination GP 10 – Hidden Surfaces GDS 12/13 – Lighting + Non-real Lighting GDS 14 – Shadows + Non-real Shadows
Tesselation and Shading Comptuer Graphics Programming R. Hoetzlein, 2011 Department of Architecture and Media Technology
When does the light equation get applied? I = N · L Lets assume the Light (L) is in a constant direction.
Object Representation OpenGL uses Polygonal modeling. All objects are approximated by small polygons.
Tesselation… Division of surface into polygons. OpenGL does not typically do this step for you..
Rasterization… What color is each pixel? We could calculate Phong reflectance model at each pixel.. eg. I = N · L N Question: What is the surface normal at each pixel? pixels polygon
What can we say about the surface normals on a flat surface or plane?
Rasterization… What color is each pixel? pixels polygon NNNNN
Using the face normal for each pixel is called flat shading. Every pixel gets the surface normal of the whole polygon. glShadeModel ( GL_FLAT ); Flat Shading
One solution… Increase tesselation… Uses a lot of polygons. To get correct images, polygons must be smaller than a pixel.
Gouraud Shading Henri Gouraud (French), 1971 “Continuous shading of curved surfaces” What if we interpolate the intensity across the polygons?
Gouraud Shading Flat Shading Notice Mach effect at edges of polygons. Mach Bands are an optical illusion. Our eye notices discontinuous changes in intensity as a jump in brightness.
Flat Shading Gouraud Shading two polygons First order discontinuous Second order discontinuous
Lets try again… Correct lighting is based on the surface normal.
What is the surface normal at this point? How about here?
Interpolating the intensity is incorrect, because we are basically guessing intensity instead of using a surface normal… Gouraud Shading N?
A vertex connecting two or more faces has a discontinuous normal.
Bui Phong Phong Interpolation.. (do not confuse with Phong Reflectance model) What we want to do is, interpolate the surface normal across polygons…
Gouraud Shading two polygons Phong Shading
Flat Shading Gouraud Shading Phong Shading
Flat ShadingNo interpolation. Each pixel uses surface normal of the whole polygon. Gouraud ShadingIntensity interpolation. Each pixel interpolates the intensity of the lighting at the polygon centers. Phong ShadingSurface normal interpolation. Each pixel interpolates the surface normal, and then computes illumination based on that normal. Shading Models
Gouraud Shading Phong Shading Flat Shading How many different normals are there? Performance
About OpenGL OpenGL implements the: Phong Reflectance Model AND Gouraud Shading OpenGL does not do Phong Shading. Reflectance ModelGives an intensity at a point based on the light vector, normal vector, and other factors. Reflectance model determines how light moves. E.g. Lambert, Phong, Blinn Shading ModelDetermines how to interpolate across polygonal surfaces to make them look smooth. E.g. Flat, Gouraud, Phong shading
Shading Models Coke Can Challenge: Which shading model should be used?