Light Issues in Computer Graphics Presented by Saleema Amershi.

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

13.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 13 An Introduction to Ray Tracing.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Lecture 14 Illumination II – Global Models
Local Reflection Model Jian Huang, CS 594, Fall 2002.
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
Graphics Graphics Korea University cgvr.korea.ac.kr Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of New Mexico
Computer Graphics - Class 10
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Lighting/Shading II Week.
Rendering (彩現 渲染).
IMGD 1001: Illumination by Mark Claypool
Ray Casting Ray-Surface Intersections Barycentric Coordinates Reflection and Transmission [Shirley, Ch.9] Ray Tracing Handouts Ray Casting Ray-Surface.
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
7M836 Animation & Rendering
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
Ray Tracing 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
Coordinate Systems X Y Z (conventional Cartesian reference system) X Y Z.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Shading Week 5, Wed 1 Oct 2003 recap: lighting shading.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Course Website: Computer Graphics 16: Illumination.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Shading Surface can either (both) 1.Emit light. E.g. light bult 2.Reflect light. E.g. Mirror.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
CSC418 Computer Graphics n Raytracing n Shadows n Global Illumination.
Illumination.
Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:
CS 445 / 645: Introductory Computer Graphics
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
COMPUTER GRAPHICS CS 482 – FALL 2014 AUGUST 27, 2014 FIXED-FUNCTION 3D GRAPHICS MESH SPECIFICATION LIGHTING SPECIFICATION REFLECTION SHADING HIERARCHICAL.
12/05/02(c) 2002 University of Wisconsin Last Time Subdivision techniques for modeling Very brief intro to global illumination.
-Global Illumination Techniques
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
David Luebke 1 10/26/2015 Lighting CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
Illumination.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Basic Ray Tracing CMSC 435/634.
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Material Representation K. H. Ko School of Mechatronics Gwangju Institute.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Written by: Itzik Ben Shabat Technion - Israel Institute of Technology Faculty of Mechanical Engineering Laboratory for CAD & Lifecycle Engineering Lab.
Written by: Itzik Ben Shabat Technion - Israel Institute of Technology Faculty of Mechanical Engineering Laboratory for CAD & Lifecycle Engineering Lab.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
OpenGL Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
Lighting and Reflection Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived color and intensity? Known as Lighting Model,
CS552: Computer Graphics Lecture 33: Illumination and Shading.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
CS552: Computer Graphics Lecture 36: Ray Tracing.
Computer Graphics: Illumination
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Basic Ray Tracing CMSC 435/634.
7. Illumination Phong Illumination Diffuse, Specular and Ambient
Lighting.
Isaac Gang University of Mary Hardin-Baylor
Advanced Computer Graphics
14th Lecture – Final Lecture
GR2 Advanced Computer Graphics AGR
CS 480/680 Computer Graphics Shading.
Presentation transcript:

Light Issues in Computer Graphics Presented by Saleema Amershi

Light plays an important part in computer graphics for rendering realistic images. Using lighting models, we can simulate shading, reflection and refraction of light, comparable to what we see in the real world.

Local illumination refers to direct interaction between one light source and one object surface. Global illumination refers to the interaction of light between all surfaces in a scene. –Responsible for shading –Reflection between surfaces –Refraction of surfaces

Local Illumination Models In computer graphics, single object-light interaction is approximated through local illumination models. Basic model used is the Phong model which breaks local illumination into 3 components: –Ambient reflection –Diffuse reflection –Specular reflection For every point, or small surface area, of an object, we want to calculate the light due to these three components.

Ambient reflection Crude approximation to global effects of light. Accounts for the general brightness in a scene from light scattering in all directions from all surfaces. I out = k ambient ∙ I ambient I is the light intensity (power per unit area), or illumination.

Diffuse Reflection All materials have diffuse properties, due to the ‘roughness’ of a surface at the microscopic level. Ideal diffuse reflection refers to light hitting a surface and then scattering evenly in all directions due to the surface ‘roughness’.

Lambert said that the energy reflected off a surface from a light source is proportional to the cosine of the incident angle, i, between the light and the normal to the surface. I out α cos(i) or I out α n ∙ l So now we have –I out = k ambient ∙ I ambient + k diffuse ∙ I light ∙ n ∙ l

Specular Reflection Shiny materials have specular properties, that give highlights from light sources. The highlights we see depends on our position relative to the surface from which the light is reflecting. For an ideal mirror, a perfectly reflected ray is symmetric with the incident ray about the normal.

But as before, surfaces are not perfectly smooth, so there will be variations around the ideal reflected ray.

Phong modelled these variations through empirical observations. As a result we have: I out = k specular ∙ I light ∙ cos s (θ) s is the shininess factor due to the surface material.

Phong Lighting Model Putting all these components together gives us: I out = k ambient ∙I ambient + k diffuse ∙I light ∙(n∙l) + k specular ∙I light ∙(v∙r) s In reality, however, we can have more then one light source reflecting light off of the same surface. This gives us: I out = k ambient ∙I ambient + ∑I light ∙ (k diffuse ∙(n∙l)+ k specular ∙(v∙r) s )

Varying shininess coefficient in specular component: Combining diffuse and specular lighting: diffuse plus specular

How do we use really use this? Viewing frustrum Z-buffering and the image plane x=left x=right y=top y=bottom z=-near x VCS y -z

Example No shadows No refractions or reflections

Ray Tracing! Better method, can show these realistic effects.

Ray Tracing Method Cast a ray from the eye (or the camera) through each pixel in the image plane, until the ray intersects an object. Calculate local illumination for this point using Phong model.

Calculating Intersections Largest computational overhead. Most objects are represented by collections of planar polygons. Intersections are between rays and planes. Implicit plane equation F(P) = N∙P + D =0 Parametric ray equation P(t) = P a + t(P b – P a )

Solve for t: F(P(t)) = N∙( P a + t(P b – P a ) + D = 0 t =( -D -N∙ P a )/( N∙ P b - N∙ P a ) Plug back into P(t) to get intersection point. Remember that calculating t is solving a quadratic. We want the first intersection of the ray with a surface, so take the smallest t value.

After finding the intersection point, we need to actually see if this point lies within the polygon that described the plane. Use barycentric coordinates to test (not covered here). Try to avoid calculating intersections, by testing whether there actually will be an intersection before calculating it.

So Whats New? Need to do more then just calculate the local illumination for the point of intersection to make full use of ray tracing. Cast secondary reflection and refraction rays from point of intersections to see other effects.

Checking for Shadows For each light source in a scene, cast a ray from that light source to the intersection point we just calculated. If the ray hits an object before reaching the point, then ignore contributions from that light source. Add this to local illumination model: I out = k ambient ∙I ambient + ∑b light I light ∙ (k diffuse ∙(n∙l)+ k specular ∙(v∙r) s ) b light is 0 or 1 depending on whether light is obstructed or not.

Refraction As we all know, lenses, glass, water and other translucent materials refract light. We can cast a secondary refraction ray from the intersection point if a material is translucent.

Snell’s Law! Computer graphics uses Snell’s law to compute the refracted ray, but in vector form. Snell’s Law: n i sin(i) = n r sin(r) Vector form: n i (l x n) = n r (r x n) Solve for r (complicated derivation) –r = n i / n r (cos(i)) – cos(r)n - n i / n r l = n i / n r (n ∙ l) – √(1- (n i / n r ) 2 (1 – (n ∙ l) 2 ) * n - n i / n r l

After calculating the direction of the refracted ray, we can cast a secondary ray in this direction and recursively look for intersections and add illumination values from these other intersections to the illumination of the original intersections. Can do the same for reflected rays off of other surfaces by casting a ray in the direction of reflection as before: r = (2l ∙ n)n - l

These secondary illumination values will not have as much weight on the illumination of the pixel as the original illumination value, as intensity of light decreases as distance increases. Add a weighting factor to these secondary illumination values to account for this. Recurse from secondary intersections.

The Ray Tracing Algorithm raytrace(ray from a pixel) -calculate closest intersection -calculate local illumination //take shadows for intersection point //into account -reflected_component = raytrace(reflected_ray) // if an object surface has reflection properties (ie. is //not completely diffuse) -refracted_component = raytrace(refraced_ray) //if an object surface is transparent -color_of_pixel = c1 * localcolor + c2 * reflected_component + c3 * refracted_component

Cool Ray Traced Images