DOC PREVIEW
CMU CS 15462 - Lighting and Shading

This preview shows page 1-2 out of 6 pages.

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

Unformatted text preview:

Remarks About Assignment 2 15 462 Computer Graphics I Lecture 7 Lighting and Shading Light Sources Phong Illumination Model Normal Vectors Angel Ch 6 1 6 4 February 4 2003 Frank Pfenning Carnegie Mellon University http www cs cmu edu fp courses graphics Remember that object transformations are applied in the reverse order in which they appear in the code Remember that transformation matrices are multiplied on the right and executed from right to left R S T v R S T v Look at the model solution when it is out and make sure you understand it before the midterm 02 04 2003 15 462 Graphics I Outline Lighting and Shading Light Sources Phong Illumination Model Normal Vectors Approximate physical reality Ray tracing 2 Follow light rays through a scene Accurate but expensive off line Radiosity Calculate surface inter reflection approximately Accurate especially interiors but expensive off line Phong Illumination model this lecture Approximate only interaction light surface viewer Relatively fast on line supported in OpenGL 02 04 2003 15 462 Graphics I 3 Radiosity Example 02 04 2003 15 462 Graphics I Raytracing Example Martin Moeck Siemens Lighting Restaurant Interior Guillermo Leal Evolucion Visual 02 04 2003 15 462 Graphics I 4 5 02 04 2003 15 462 Graphics I 6 1 Light Sources and Material Properties Types of Light Sources Appearance depends on Light sources their locations and properties Material surface properties Viewer position Ray tracing from viewer into scene Radiosity between surface patches Phong Model at material from light to viewer Ambient light no identifiable source or direction Point source given only by point Distant light given only by direction Spotlight from source in direction Cut off angle defines a cone of light Attenuation function brighter in center Light source described by a luminance Each color is described separately I Ir Ig Ib T I for intensity Sometimes calculate generically applies to r g b 02 04 2003 15 462 Graphics I 7 02 04 2003 15 462 Graphics I Ambient Light Point Source Global ambient light Given by a point p0 Light emitted equally in all directions Independent of light source Lights entire scene 8 Local ambient light Contributed by additional light sources Can be different for each light and primary color Intensity decreases with square of distance Computationally inexpensive 02 04 2003 15 462 Graphics I 9 02 04 2003 15 462 Graphics I Limitations of Point Sources Distant Light Source Given by a vector v Simplifies some calculations In OpenGL Shading and shadows inaccurate Example penumbra partial soft shadow Similar problems with highlights Compensate with attenuation 10 Point source x y z 1 T Distant source x y z 0 T d distance p p0 a b c constants Softens lighting Better with ray tracing Better with radiosity 02 04 2003 15 462 Graphics I 11 02 04 2003 15 462 Graphics I 12 2 Spotlight Spotlight Attenuation Most complex light source in OpenGL Light still emanates from point Cut off by cone determined by angle Spotlight is brightest along ls Vector v with angle from p to point on surface Intensity determined by cos Corresponds to projection of v onto Is Spotlight exponent e determines rate for e 1 for e 1 curve narrows 02 04 2003 15 462 Graphics I 13 02 04 2003 15 462 Graphics I Outline Phong Illumination Model Light Sources Phong Illumination Model Normal Vectors 14 Calculate color for arbitrary point on surface Compromise between realism and efficiency Local computation no visibility calculations Basic inputs are material properties and l n v l vector to light source n surface normal v vector to viewer r reflection of l at p determined by l and n 02 04 2003 15 462 Graphics I 15 02 04 2003 15 462 Graphics I Basic Calculation Ambient Reflection Calculate each primary color separately Start with global ambient light Add reflections from each light source Clamp to 0 1 Reflection decomposed into Ambient reflection Diffuse reflection Specular reflection 16 Intensity of ambient light uniform at every point Ambient reflection coefficient ka 0 ka 1 May be different for every surface and r g b Determines reflected fraction of ambient light La ambient component of light source Ambient intensity Ia ka La Note La is not a physically meaningful quantity Based on ambient diffuse and specular lighting and material properties 02 04 2003 15 462 Graphics I 17 02 04 2003 15 462 Graphics I 18 3 Diffuse Reflection Lambert s Law Intensity depends on angle of incoming light Recall Diffuse reflector scatters light Assume equally all direction Called Lambertian surface Diffuse reflection coefficient k d 0 kd 1 Angle of incoming light still critical l unit vector to light n unit surface normal angle to normal cos l n Id kn l n L d With attenuation q distance to light source Ld diffuse component of light 02 04 2003 15 462 Graphics I 19 02 04 2003 15 462 Graphics I Specular Reflection Shininess Coefficient Specular reflection coefficient ks 0 ks 1 Shiny surfaces have high specular coefficient Used to model specular highlights Do not get mirror effect need other techniques specular reflection 02 04 2003 specular highlights 15 462 Graphics I 21 Ls is specular component of light r is vector of perfect reflection of l about n v is vector to viewer is angle between v and r Is ks Ls cos is shininess coefficient Compute cos r v Requires r v 1 Multiply distance term Higher is narrower 02 04 2003 15 462 Graphics I Summary of Phong Model BRDF Light components for each color Bidirectional Reflection Distribution Function Measure for materials Isotropic vs anisotropic Mathematically complex Programmable pixel shading Ambient L a diffuse L d specular L s Material coefficients for each color Ambient k a diffuse k d specular k s Distance q for surface point from light source l vector from light n surface normal 02 04 2003 r l reflected about n v vector to viewer 15 462 Graphics I 23 20 02 04 2003 15 462 Graphics I 22 24 4 Outline Normal Vectors Light Sources Phong Illumination Model Normal Vectors Summarize Phong Surface normal n is critical Calculate l n Calculate r and then r v Must calculate and specify the normal vector Even in OpenGL Two examples plane and sphere 02 04 2003 15 462 Graphics I 25 02 04 2003 15 462 Graphics I 26 Normals of a Plane Method I Normals of a Plane Method II Method I given by ax by cz d 0 Let p0 be a known point on the plane Let p be an arbitrary point on the plane Recall u v 0 iff u orthogonal v n p p0 n p n p0 0 Consequently n0 a b c 0 T Normalize to n n 0 n0 02


View Full Document

CMU CS 15462 - Lighting and Shading

Download Lighting and Shading
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 Lighting and Shading 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 Lighting and Shading 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?