DOC PREVIEW
CMU CS 15462 - OpenGL Lighting

This preview shows page 1-2-20-21 out of 21 pages.

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

Unformatted text preview:

OpenGL Lighting15-462 Computer GraphicsSpring 2009Frank Palermo“OpenGL is just a bunch of hacks.” -Adrien TreuilleWhat Adrien Means...●What Adrien means is that OpenGL was designed to produce reasonable-looking 3D images quickly & simply.●A lot of its design is not based on the way light actually behaves in the real world, or on the way we perceive a scene.●Keep that in mind as we discuss the OpenGL pipeline and lighting model.The OpenGL Pipeline* Featuring slides shamelessly stolen from a previous teaching of 15-462!The OpenGL Pipeline* Featuring slides shamelessly stolen from a previous teaching of 15-462!The OpenGL Pipeline* Featuring slides shamelessly stolen from a previous teaching of 15-462!The OpenGL Pipeline* Featuring slides shamelessly stolen from a previous teaching of 15-462!The OpenGL Pipeline* Featuring slides shamelessly stolen from a previous teaching of 15-462!The OpenGL Pipeline* Featuring slides shamelessly stolen from a previous teaching of 15-462!OpenGL Lighting●By default, OpenGL's fixed-function pipeline implements the Blinn-Phong Shading Model.–Originally from Bui Tuong Phong's Ph.D. work at the University of Utah (1973).–Modified by James F. Blinn (1977).●Light is modeled in three categories: ambient, diffuse, and specular.Ambient Lighting●Approximates the low level of light that is normally present everywhere in a scene (scattered by many objects before reaching the eye).●Constant term; applies equally to all points on the object.Image: Brad SmithDiffuse Lighting●Approximates light scattered by objects with rough surfaces.●Its intensity depends on the angle between the light source and the surface normal (not the direction to the viewer).Image: Brad SmithSpecular Lighting●Approximates light reflected by “shiny” objects with smooth surfaces.●Its intensity depends on the angle between the viewer and the direction of a ray reflected from the light source.Image: Brad SmithThe Equation●Ka, Kd, Ks = Ambient, Diffuse, and Specular Color (Set for Materials , i.e. Objects)●Ia, Id, Is = Ambient, Diffuse, and Specular Intensity (Set for Lights)●Dot Products: Provide the dependence on the light-surface and reflection-viewer angles discussed earlier.The Blinn-Phong Model In OpenGL●Phong: The calculation is done over the entire surface.●Blinn-Phong: The calculation is done only at vertices; the remainder of the surface is interpolated from surrounding vertices.Image: Brad SmithEmissive Lighting●OpenGL adds emissive lighting, which allows an object to “glow” with its own light.●Is this everything we need to model all possible lighting phenomena?The Blinn-Phong Model In OpenGL●OpenGL evaluates the equation for you. You just need to set the material parameters and light intensities (and provide surface normals!).●Chapter 5 of the OpenGL Programming Guide describes the commands you will need and gives examples of their use.Some OpenGL Commands●Setting light intensities:glLightfv(GL_LIGHT0, GL_DIFFUSE, Id);glLightfv(GL_LIGHT0, GL_SPECULAR, Is);●Setting material colors:glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, Ka);glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, Kd);glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Ks);●Setting surface normals:glVertex3dv(&vertices[0].x);glNormal3dv(&normals[1].x);Limitations of OpenGL Lighting●The pipeline is essentially one-way (left to right on the illustration). ●Once a polygon has been rendered, it's forgotten and can't be used as part of any other lighting calculations.●No mirrors, glow sticks made with emissive light won't actually light up anything else in the scene, etc.●Can only capture light source → object → viewer (called “direct illumination”).Direct vs. Global Illumination●"Fast Separation of Direct and Global Components of a Scene using High Frequency Illumination" by Nayar et. al. (SIGGRAPH 2006).●OpenGL could render the image at center, but it would miss all of the information in the image at right.Solutions?●Use a completely different algorithm such as raytracing or photon mapping which supports global illumination.–Projects 3 & 4.●Program the pipeline to behave differently using GLSL.–Project 2.●Be happy with Blinn-Phong.–Project 1 (and lecture next


View Full Document

CMU CS 15462 - OpenGL Lighting

Download OpenGL Lighting
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 OpenGL Lighting 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 OpenGL Lighting 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?