DOC PREVIEW
CMU CS 15462 - Lighting and Shading

This preview shows page 1-2-23-24 out of 24 pages.

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

Unformatted text preview:

1Properties of LightLight SourcesPhong Illumination ModelNormal Vectors[Angel, Ch. 6.1-6.4]Properties of LightLight SourcesPhong Illumination ModelNormal Vectors[Angel, Ch. 6.1-6.4]Lighting and ShadingLighting and ShadingAnnouncementsAnnouncements• Written assignment #1 due Thursday – Handin at beginning of class• Programming assignment #2 out Thursday2The Rendering EquationThe Rendering Equation• (Angel, Ch 13)OutlineOutline• Lighting models (OpenGL oriented)• Reflection models (Phong shading)• Normals• Color3Common Types of Light SourcesCommon Types of Light Sources• 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 = [IrIgIb]T(I for intensity)– Sometimes calculate generically (applies to r, g, b)Ambient LightAmbient Light• Intensity is the same at all points• This light does not have a direction (or .. it is the same in all directions)4Point SourcePoint Source• Given by a point p0• Light emitted from that point equally in all directions• Intensity decreases with square of distanceOne Limitation of Point SourcesOne Limitation of Point Sources• Shading and shadows inaccurate• Example: penumbra (partial “soft” shadow)5Distant Light SourceDistant Light Source• Given by a vector v• Intensity does not vary with distance (all distances are the same .. infinite!)SpotlightSpotlight• Most complex light source in OpenGL• Light still emanates from point• Cut-off by cone determined by angle T6Spotlight AttenuationSpotlight Attenuation• Spotlight is brightest along ls• Vector v with angle I from p to point on surface• Intensity determined by cos I• Corresponds to projection of v onto Is• Spotlight exponent e determines ratefor e = 1for e > 1curve narrowsFor any of these light sources, it is easy to compute illumination arriving at a point (e.g., a vertex)For any of these light sources, it is easy to compute illumination arriving at a point (e.g., a vertex)7Now we can think about how the incoming light is reflected by a surface Now we can think about how the incoming light is reflected by a surface Surface Reflection• When light hits an opaque surface some is absorbed, the rest is reflected (some can be transmitted too--but never mind for now)• The reflected light is what we see• Reflection is not simple and varies with material– the surface’s micro structure define the details of reflection– variations produce anything from bright specular reflection (mirrors) to dull matte finish (chalk)Incident LightReflected LightCameraSurface8Phong Illumination ModelPhong Illumination Model• Calculate color for arbitrary point on surface• Basic inputs are material properties and l, n, v:l = vector to light sourcen = surface normalv = vector to viewerr = reflection of l at p(determined by l and n)Basic CalculationBasic Calculation• 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• Based on ambient, diffuse, and specularlighting and material properties9Ambient ReflectionAmbient Reflection• Intensity of ambient light uniform at every point• Ambient reflection coefficient ka, 0 w kaw 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= kaLa• Note: Lais not a physically meaningful quantityDiffuse ReflectionDiffuse Reflection• Diffuse reflector scatters light• Assume equally all direction• Called Lambertian surface• Diffuse reflection coefficient kd, 0 w kdw 1• Angle of incoming light still critical10Lambert’s LawLambert’s Law• Intensity depends on angle of incoming light• Recalll = unit vector to lightn = unit surface normalT = angle to normal• cos T = l d n• Id= kn(l d n) Ld• With attenuation:q = distance to light source,Ld= diffuse component of lightSpecular ReflectionSpecular Reflection• Specular reflection coefficient ks, 0 w ksw 1• Shiny surfaces have high specular coefficient• Used to model specular highlights• Do not get mirror effect (need other techniques)specular reflectionspecular highlights11Shininess CoefficientShininess Coefficient• Lsis specular component of light• r is vector of perfect reflection of l about n• v is vector to viewer• I is angle between v and r• Is= ksLscosDI• D is shininess coefficient• Compute cos I = r d v• Requires |r| = |v| = 1• Multiply distance termHigher D is narrowerSummary of Phong ModelSummary of Phong Model• Light components for each color:– 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 sourcel = vector from lightn = surface normalr = l reflected about nv = vector to viewer12Comparison of Phong model to the rendering equationComparison of Phong model to the rendering equationRaytracing ExampleRaytracing ExampleMartin Moeck,Siemens Lighting13Radiosity ExampleRadiosity ExampleRestaurant Interior. Guillermo Leal, Evolucion VisualBRDFBRDF• Bidirectional Reflection Distribution Function• Measure formaterials• Isotropic vs.anisotropic• Mathematicallycomplex14Accurate normal vectors are important for modeling surface reflectionAccurate normal vectors are important for modeling surface reflectionNormal VectorsNormal Vectors• Summarize Phong• Surface normal n is critical– Calculate l d n– Calculate r and then r d v• Must calculate and specify the normal vector– Even in OpenGL!• Two examples: plane and sphere15Normals of a Plane, Method INormals of a Plane, Method I• Method I: given by ax + by + cz + d = 0• Let p0be a known point on the plane• Let p be an arbitrary point on the plane• Recall: u d v = 0 iff u orthogonal v• n d (p – p0) = nd p – nd p0= 0• We know that [a b c 0] Td p0= -d (because p0 satisfies the plane equation)• Consequently n0must be [a b c 0]T• Normalize to n = n0/|n0|Normals of a Plane, Method IINormals of a Plane, Method II• Method II: plane given by p0, p1, p2•


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?