Local Illumination and Shading

Slides:



Advertisements
Similar presentations
7.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 7 Polygon Shading Techniques.
Advertisements

Lecture 14 Illumination II – Global Models
Computer Graphics Inf4/MSc Computer Graphics Lecture 13 Illumination I – Local Models.
CSPC 352: Computer Graphics
Computer Graphics (Fall 2008) COMS 4160, Lecture 18: Illumination and Shading 1
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 21: Radiometry Many slides courtesy Pat Hanrahan.
Advanced Computer Graphics (Spring 2013) CS 283, Lecture 8: Illumination and Reflection Many slides courtesy.
1 Computer Graphics By : Mohammed abu Lamdy ITGD3107 University of Palestine Supervision: Assistant Professor Dr. Sana’a Wafa Al-Sayegh.
Illumination and Shading
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 III Week.
Rendering (彩現 渲染).
IMGD 1001: Illumination by Mark Claypool
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
Computer Graphics (Spring 2008) COMS 4160, Lecture 20: Illumination and Shading 2
Lighting and Shading Wen-Chieh (Steve) Lin
Computer Graphics (Fall 2008) COMS 4160, Lecture 19: Illumination and Shading 2
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.
CS 376 Introduction to Computer Graphics 03 / 30 / 2007 Instructor: Michael Eckmann.
Computer Graphics (Fall 2004) COMS 4160, Lecture 16: Illumination and Shading 2 Lecture includes number of slides from.
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Shading Week 5, Wed 1 Oct 2003 recap: lighting shading.
Illumination and Shading
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
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
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Shading Shading.
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.
Shading / Light Thanks to Srinivas Narasimhan, Langer-Zucker, Henrik Wann Jensen, Ravi Ramamoorthi, Hanrahan, Preetham.
-Global Illumination Techniques
Taku KomuraComputer Graphics Local Illumination and Shading Computer Graphics – Lecture 10 Taku Komura Institute for Perception, Action.
Steve Sterley. Real World Lighting Physical objects tend to interact with light in three ways: Absorption (black body) Reflection (mirror) Transmission.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
Illumination and Shading How to shade surfaces based on the position,orientation,characteristics of the surfaces and the light sources illuminating them.
CSE 381 – Advanced Game Programming GLSL Lighting.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Komputer Grafik 2 (AK045206) Shading 1/17 Realisme : Shading.
Illumination and Shading
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
CS 445 / 645 Introduction to Computer Graphics Lecture 15 Shading Shading.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
Chris Mayer & Nic Shulver Shading Definitions Light emanating from small surfaces is called a Point light sourcee.g. the sun (not really small though!)
Where We Stand So far we know how to: –Transform between spaces –Rasterize –Decide what’s in front Next –Deciding its intensity and color.
Lighting and Shading Part 2. Global Ambient Light There are at least 8 OpenGL lights and 1 Global Ambient Setting the Global Ambient globalAmbient[] =
Illumination Model How to compute color to represent a scene As in taking a photo in real life: – Camera – Lighting – Object Geometry Material Illumination.
Illumination and Shading Sang Il Park Sejong University.
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
David Luebke3/16/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived color and intensity? Known as Lighting Model,
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Computer Graphics: Illumination
Computer Graphics (Fall 2006) COMS 4160, Lecture 16: Illumination and Shading 1
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Illumination : Hearn & Baker Ch. 10
Chapter 14 Shading Models.
Computer Graphics Material Colours and Lighting
Computer Graphics (Fall 2003)
Chapter 14 Shading Models.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Presentation transcript:

Local Illumination and Shading Computer Graphics – Lecture 3 Taku Komura tkomura@ed.ac.uk Institute for Perception, Action & Behaviour

Today is about calculating the color of objects The incident light Position of light source Direction Color The object Reflectance Viewer Position

Overview Illumination (how to calculate the colour)‏ Shading (how to colour the whole surface)? BRDF (how to simulate the reflection of real objects)‏

Illumination Simple 3 parameter model + + = Ambient (colour)‏ Diffuse The sum of 3 illumination terms: Ambient : 'background' illumination Specular : bright, shiny reflections Diffuse : non-shiny illumination and shadows 'Virtual' camera + + = Ambient (colour)‏ Diffuse (directional)‏ Specular (highlights)‏ Rc

Ambient Lighting Object Light from the environment light reflected or scattered from other objects Coming uniformly from all directions and then reflected equally to all directions simple approximation to complex 'real-world' process Result: globally uniform colour for object I = resulting intensity Ia = light intensity ka = reflectance Example: sphere Object

Diffuse Lighting Light reflected to all directions Ln N  I Object considers the angle of incidence of light on surface (angle between light and surface normal)‏ Also known as Lambertian reflection Result: lighting varies over surface with orientation to light Ln Infinite point light source Example: sphere (lit from left)‏ N  I Object No dependence on camera angle!

Specular Lighting Direct reflections of light source off shiny object specular intensity n = shiny reflectance of object Result: specular highlight on object Ln N Infinite point light source R (Reflection)‏   α Object Ip: light intensity I : output color R: reflection vector S : direction towards the camera α : angle between R and S No dependence on object colour.

Specular Light

Combined Lighting Models Summing it altogether : Phong Illumination Model + + = Ambient (colour)‏ Diffuse (directional)‏ Specular (highlights)‏ Rc

When you implement it… Use dot product of the vectors instead of calculating the angles N L R   α Object V : Vector from the surface to the viewer : Normal vector at the colored point : Normalized reflection vector : Normalized vector from the coloured point towards the light source

Demo applets http://www.cs.auckland.ac.nz/~richard/research- topics/PhongApplet/PhongDemoApplet.html

Local Illumination Model Considers light sources and surface properties only. Not considering the light reflected back onto other surfaces Fast real-time interactive rendering. Most real-time graphics (games, virtual environments) are based on local illumination models Implementation - OpenGL, Direct3D

Attenuation Haven’t considered light attenuation – the light gets weaker when the object is far away Use 1/(s+k) where s relates to eye-object distance and k is some constant for scene. Note: must apply 3 times – for each primary colour

Color Finally color the pixel by the RGB color

Overview Illumination (how to calculate the color)‏ Shading (how to color the whole surface)?

How often do we do the computation of illumination? At all the points on the surface? But usually we have normals only at the vertices Depends on the shading model – Flat Shading (once per polygon)‏ (less computation needed) – Gouraud shading (once per vertex)‏ – Phong Shading (once per pixel)‏ (heavy computation needed)‏

Flat Shading Compute the colour at the middle of the polygon All points in the same polygon are coloured by the same colour

Shading Polyhedra Flat (facet) shading: really made of flat faces. Works well for objects really made of flat faces. Appearance depends on number of polygons for curved surface objects. If polyhedral model is an approximation then need to smooth.

Mach banding. Physiological effect exaggerates difference between closely coloured polygons. Mach banding. Exaggerates intensity change at an edge with a discontinuity in magnitude. Our eyes are well adapted to seeing edges ! Using a finer mesh is surprisingly ineffective.

Gouraud Shading (Smooth Shading) Compute the color at each vertex first Compute the color inside the polygon by interpolating the colors of the vertices composing the polygon

Gouraud shading

Gouraud Shading. Find vertex normals by averaging face normals B A - Use vertex normals with desired shading model, Interpolate vertex intensities along edges. Interpolate edge values across a scanline. B A Ibc Iac Iac interpolated A to C, Ibc interpolated B to C. C

Phong Shading interpolating the normal vectors at the vertices Do the computation of illumination at each point in the polygon

Phong shading. For specular reflection, highlight falls off with cosn  Gouraud shading linear interpolates – makes highlight too big. Gouraud shading may well miss a highlight that occurs in the middle of the face. Direction of maximum highlight

Phong shading. In Phong model of specular reflection, highlight falls off with cosn  Gouraud shading linear interpolates – makes highlight too big. Gouraud shading may well miss a highlight that occurs in the middle of the face. Direction of maximum highlight Highlight on surface.

Phong example

Gouraud Shaded Floor Phong Shaded Floor Gouraud shading is not good when the polygon count is low

Problems with interpolation shading. Problems with computing vertex normals. A B C A,B are shared by all polygons, but C is not shared by the polygon on the left. Shading information calculated to the right of C will be different from that to the left. Shading discontinuity. Solution 1: subdivide into triangles that that share all the vertices Solution 2 : introduce a ‘ghost’ vertex that shares C’s values

Problems with interpolation shading. Problems with computing vertex normals. Face surface normals and averaged vertex normals shown. Unrepresentative so add small polygon strips along edges or test angle and threshold to defeat averaging.

Problems with interpolation shading. Rotational invariance? When interpolating the colour inside a polygon, the edge colours are determined first, and then they are interpolated to compute the internal colour If the number of edges is >= 4, the results of interpolation shading can change with orientation of the polygon. A B C D Point on left is interpolated between AD & AB , Point on right is interpolated between AB & BC C

Problems with interpolation shading. Solution. Decompose polygon into triangles before Gouraud shading.

Overview Illumination (how to calculate the color)‏ Shading (how to color the whole surface)? BRDF (how to simulate the reflection of real objects)‏

What about real objects? Phong Illumination model is popular but actually it is not accurate True photorealism, requires more sophisticated and elaborate models of surface properties

Reflectance of objects The way the light reflects depends on the physical characteristics of the surface Its not uniform

Bidirectional Reflectance Distribution Function (BRDF)‏ The reflectance of an object can be represented by a function of the incident and reflected angles This function is called the Bidirectional Reflectance Distribution Function (BRDF)‏ where E is the incoming irradiance and L is the reflected radiance

What affects the BRDF? The way light reflecting over the surface The smoothness/roughness of the surface Single reflection : if smooth, specular Multiple reflections : diffusive The shadowing effect

Isotropic and Anisotropic BRDFs Can model by diffuse + specular reflection Anisotripic Brushed metal Cannot model by diffuse + specular reflection Reflectance changing systematically with respect to direction

Measuring the BRDF Measured using a device called gonioreflectometer Casting light from various directions to the object, and capturing the light reflected back

Summary Illumination model Shading BRDF Phong model Flat, Gouraud, Phong Shading BRDF Measuring

Recommended Reading Foley et al. Chapter 16, sections 16.1.6 up to and including section 16.3.4. Introductory text Chapter 14, sections 14.1.6 up to and including section 14.2.6.