Logistics • Projects Local Illumination – Proposal due on Thursday Logistics Computer Graphics as Virtual Photography • Paper summaries on Local Illumination real camera photo Photographic Photography: scene (captures processing print – Any takers? light) processing camera Computer 3D synthetic tone model Graphics: models image reproduction (focuses simulated lighting) Today’s Class Shading • Computing the light that leaves a point • Local illumination • Shading point - point under investigation • Last time we looked at illumination models • Illumination model - function or algorithm • This time, take a look at: used to describe the reflective – Shading models – applying these illumination characteristics of a given surface. models • Shading model – algorithm for using an illumination model to determine the color of a point on a surface.
Shading Models Shading Models • Direct Shading Models • Illumination vs. Shading Models – Only considers direct lighting from light sources – Each of the Illumination Models given last – Flat (constant) shading class could be applied by either a local or – Gouraud Shading global shading algorithm – Phong Shading – The illumination models are not global vs. • Global Illumination Algorithms local, the shading models are. – Considers indirect lighting from interreflections off of other objects – Radiosity – Ray Tracing Shading Models Shading Models • Geometry • Flat Shading – Illumination model applied once per polygon. – Constant color for entire polygon – Assumes normal vector is constant across the entire polygon Shading Models Shading Models • Gouraud Shading • Phong Shading – Illumination is interpolated across each polygon – Normal vectors are interpolated across each polygon – Normals required at each polygon vertex – Normals required at each polygon vertex – Illumination is calculated for each polygon vertex – Illumination is calculated for each polygon interior point by applying illumination model – Interior points interpolated from endpoint directly using interpolated normal illumination intensities
Shading Models Computer Graphics as Virtual Photography – Go to applet real camera photo Photographic Photography: scene (captures processing print light) processing camera Computer 3D synthetic tone model Graphics: models reproduction image (focuses simulated lighting) Rasterization Gouraud Rendering Pipeline • Visible Surface Determination Trivial Database Model Lighting – Determine what is rendered where Accept / traversal transform Reject – Done in 2D camera space – Image precision vs object precision • Image Precision – determine for each pixel, what Rasterization View Clipping Projection object is visible at the pixel transform • Object Precision – determine for each object, the part of the object that is visible. Display Image Precision Object Precision For each pixel in image { For each object in scene { O = object that is closest determine parts of object non obscured draw pixel with appropriate color from O draw these parts } }
Z-buffer Z-buffer • Visible surface algorithm to determine what • Basic algorithm object appears on a given pixel Initialize frame buffer (to background) Initialize Z-buffer (to 0) – Image Precision Algorithm – Two frame buffers For each polygon P { For each pixel p in polygon’s projection { • One contains colors z = P’s z at pixel p • One contains depth values (Z-buffer) if (z > Zbuffer at that pixel) { – Basic idea zBuffer at pixel = z Frame buffer at pixel = calcColor() • Only calculate shading on object if depth is closer to } value at z-buffer } Z-buffer Z-buffer • Applet Interpolation p1 Scan line p2 p3 Gouraud Rendering Pipeline Phong Rendering Pipeline Trivial Trivial Database Model Lighting Database Model View Accept / Accept / traversal transform traversal transform transform Reject Reject Rasterization Rasterization Display View Clipping Projection Clipping Projection and lighting transform Display
List Priority Algorithms To summarize • Local Illumination models • Object precision and image-precision – Only considers first reflection of light with object – Sort polygons by z – No shadows (unless you add them) – Rasterize each polygon in order • Shading vs. Illumination Models – Problems: – A shading model can use any illumination model • Polygons must not overlap in z – Phong was a busy guy! • If they do, they must be split • Rasterization – Scan conversion / Interpolation in 2D – Z-buffer Next time • Global Illumination – Rendering in the real world • Sampling Theory & Aliasing • Proposals due • Class Web Site: – http://www.cs.rit.edu/~jmg/cgII • Any questions?
Recommend
More recommend