250 likes | 260 Views
Explore tesselation, surface division, shading techniques, and lighting models in computer graphics programming. Learn about flat shading, Gouraud shading, Phong shading, and the OpenGL reflectance model. Gain insights into surface normals, pixel color calculations, and polygonal modeling.
E N D
Schedule Update GP 4 – Tesselation/CgGDS 4 – Subdiv Surf. GP 5 – Object ModelingLab: Mini-proj Setup GDS 5 – Maya Modeling MCG 6 – Intersections GP 6 – RaytracingLab: Mini-proj DUE GDS 6/7 – RaytracingLab: Your object GP 7 – Texture Mapping GDS 8/9 – Textures+ Non-realistic Texturing GP 8 – Viewing transforms GDS 10 – Camerasand Framing GP 9 – Real-Time G.I. GDS 11 – GlobalIllumination GP 10 – Hidden Surfaces GDS 12/13 – Lighting+ Non-real Lighting GDS 14 – Shadows+ Non-real Shadows
Tesselation and Shading Comptuer Graphics ProgrammingR. Hoetzlein, 2011Department 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? N pixels polygon We could calculate Phong reflectance model at each pixel.. eg. I = N · L Question: What is the surface normal at each pixel?
What can we say about the surface normals on a flat surface or plane?
Rasterization… What color is each pixel? N N N N N pixels polygon
Flat Shading Using the face normal for each pixel is called flat shading.Every pixel gets the surface normal of the whole polygon. glShadeModel ( GL_FLAT );
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?
Flat Shading Gouraud 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 First orderdiscontinuous Gouraud Shading Second orderdiscontinuous two polygons
Lets try again…Correct lighting is based on the surface normal.
What is the surface normal at this point? How about here?
Gouraud Shading N ? Interpolating the intensity is incorrect, because we are basically guessing intensity instead of using a surface normal…
A vertex connecting two or more faces has a discontinuous normal.
Bui PhongPhong Interpolation.. (do not confuse with Phong Reflectance model)What we want to do is, interpolate the surface normal across polygons…
Gouraud Shading Phong Shading two polygons
Flat Shading Gouraud Shading Phong Shading
Shading Models Flat Shading No interpolation. Each pixel uses surface normal of the whole polygon. Gouraud Shading Intensity interpolation. Each pixel interpolates the intensity of the lighting at the polygon centers.Phong Shading Surface normal interpolation. Each pixel interpolates the surface normal, and then computes illumination based on that normal.
Performance Flat Shading How many different normals are there? Gouraud Shading Phong Shading
About OpenGL Reflectance Model Gives 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, BlinnShading Model Determines how to interpolate across polygonal surfaces to make them look smooth. E.g. Flat, Gouraud, Phong shading OpenGL implements the: Phong Reflectance Model AND Gouraud ShadingOpenGL does not do Phong Shading.
Shading Models Coke Can Challenge: Which shading model should be used?