Illumination and Shading

Similar documents
Sung-Eui Yoon ( 윤성의 )

Illumination & Shading: Part 1

Illumination & Shading

Topic 9: Lighting & Reflection models. Lighting & reflection The Phong reflection model diffuse component ambient component specular component

Topic 9: Lighting & Reflection models 9/10/2016. Spot the differences. Terminology. Two Components of Illumination. Ambient Light Source

Computer Graphics. Illumination and Shading

CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL:

Illumination and Shading ECE 567

CSE 681 Illumination and Phong Shading

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

CPSC 314 LIGHTING AND SHADING

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1

Illumination and Shading

Introduction to Computer Graphics 7. Shading

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

CS5620 Intro to Computer Graphics

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Comp 410/510 Computer Graphics. Spring Shading

Classic Rendering Pipeline

Shading I Computer Graphics I, Fall 2008

Objectives. Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading.

Shading and Illumination

Illumination & Shading

University of British Columbia CPSC 314 Computer Graphics Sep-Dec Tamara Munzner (guest lecturing) Lighting/Shading

Reading. Shading. An abundance of photons. Introduction. Required: Angel , 6.5, Optional: Angel 6.4 OpenGL red book, chapter 5.

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL

Light Transport Baoquan Chen 2017

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Illumination Models & Shading

Why we need shading?

Lighting/Shading III. Week 7, Wed Mar 3

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

INF3320 Computer Graphics and Discrete Geometry

w Foley, Section16.1 Reading

Illumination. Illumination CMSC 435/634

Rendering. Illumination Model. Wireframe rendering simple, ambiguous Color filling flat without any 3D information

Computer Graphics. Shading. Based on slides by Dianna Xu, Bryn Mawr College

Reading. Shading. Introduction. An abundance of photons. Required: Angel , Optional: OpenGL red book, chapter 5.

CEng 477 Introduction to Computer Graphics Fall

Light Sources. Spotlight model

Computer Graphics. Illumination and Shading

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

Pipeline Operations. CS 4620 Lecture 10

Lighting/Shading II. Week 7, Mon Mar 1

Lecture 15: Shading-I. CITS3003 Graphics & Animation

WHY WE NEED SHADING. Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like.

CPSC / Illumination and Shading

Shading Intro. Shading & Lighting. Light and Matter. Light and Matter

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

Reflection and Shading

7: Rendering (1) COMP Computer Graphics and Image Processing. Local illumination model. Global illumination model. Direct Direct.

Illumination & Shading I

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

Lighting and Shading

Illumination and Shading

Illumination Model. The governing principles for computing the. Apply the lighting model at a set of points across the entire surface.

Visualisatie BMT. Rendering. Arjan Kok

Illumination and Shading - II

Illumination in Computer Graphics

Shading. Why we need shading. Scattering. Shading. Objectives

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I

Virtual Reality for Human Computer Interaction

Shading , Fall 2004 Nancy Pollard Mark Tomczak

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model

Shading & Material Appearance

LIGHTING AND SHADING

surface: reflectance transparency, opacity, translucency orientation illumination: location intensity wavelength point-source, diffuse source

Simple Lighting/Illumination Models

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch

Virtual Reality for Human Computer Interaction

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

CSE 167: Lecture #7: Color and Shading. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

Illumination and Shading

Ambient reflection. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 407

Pipeline Operations. CS 4620 Lecture 14

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

Shading. Brian Curless CSE 557 Autumn 2017

CS230 : Computer Graphics Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

Interactive Real-Time Raycasting

Shading. Brian Curless CSE 457 Spring 2015

Raytracing CS148 AS3. Due :59pm PDT

Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)

M jrs M jgs M jbs Intensity of light reflected from surface j when illuminated by source i: I ijr

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

CS Surface Rendering

Shading. CSE 457 Winter 2015

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

OpenGL Lighting Computer Graphics Spring Frank Palermo

Lighting and Materials

Lighting affects appearance

CS452/552; EE465/505. Intro to Lighting

Complex Shading Algorithms

Shading 1: basics Christian Miller CS Fall 2011

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Transcription:

Illumination and Shading Computer Graphics COMP 770 (236) Spring 2007 Instructor: Brandon Lloyd 2/14/07 1

From last time Texture mapping overview notation wrapping Perspective-correct interpolation Texture filtering Bilinear interpolation MIP maps Summed-area tables 2/14/07 2

Topics for today Light Sources Empirical Illumination Shading Local vs Global Illumination 2/14/07 3

Illumination Models Computer Graphics Jargon: Illumination - the transport luminous flux from light sources between surfaces via direct and indirect paths Lighting - the process of computing the luminous intensity reflected from a specified 3-D point Shading - the process of assigning a colors to a pixels Illumination Models: Empirical - simple formulations that approximate observed phenomenon Physically-based - models based on the actual physics of light's interactions with matter 2/14/07 4

Two components of illumination Light Sources: Emittance spectrum (color) Geometry (position and direction) Directional attenuation Surface Properties: Reflectance spectrum (color) Geometry (position, orientation, and micro-structure) Absorption Simplifications used by most computer graphics systems: Compute only direct illumination from the emitters to the reflectors of the scene Ignore the geometry of light emitters, and consider only the geometry of reflectors 2/14/07 5

Ambient light source Ambient light sources are a simple hack for indirect illumination Incoming ambient illumination (I i,a ) is constant for all surfaces in the scene Reflected ambient illumination (I r,a ) depends only on the surface s ambient reflection coefficient (k a ) and not its position or orientation I r,a = k I a i,a These quantities typically specified as (R, G, B) triples 2/14/07 6

Point light sources Point light sources emit rays from a single point a fair approximation to a local light source such as a light bulb The direction to the light changes across the surface p l ˆL = p p p p l l ˆL p 2/14/07 7

Directional light sources Light rays are parallel and have no origin Can be considered as a point light at infinity A good approximation for sunlight The direction to the light source is constant over the surface ˆL 2/14/07 8

Lights in OpenGL Light positions are specified in homogeneous coordinates They are transformed by the current modelview matrix Directional light sources have w=0 # define a directional light lightdirection = [1, 1, 1, 0] gllightfv(gl_light0, GL_POSITION, lightdirection) glenable(gl_light0) # define a point light lightpoint = [100, 100, 100, 1] gllightfv(gl_light1, GL_POSITION, lightpoint) glenable(gl_light1) # set up light s color gllightfv(gl_light0, GL_AMBIENT, ambientintensity) gllightfv(gl_light0, GL_DIFFUSE, diffuseintensity) gllightfv(gl_light0, GL_SPECULAR, specularintensity) 2/14/07 9

Other light sources Spotlights point source whose intensity falls off away from a given direction Area Light Sources occupies a 2-D area (e.g. a polygon or a disk) generates soft shadows Extended Light Sources occupies a 3-D area (e.g. a sphere) generates soft shadows Area and extended often used interchangeably 2/14/07 10

Ideal diffuse reflection Ideal diffuse reflectors very rough at the microscopic level microscopic variations in the surface make any direction over the hemisphere equally likely to be the reflected direction of an incoming light ray reflection is view-independent follow Lambert s cosine law Chalk is a good approximation to an ideal diffuse surface 2/14/07 11

Lambert s cosine law Lambert s cosine law : the reflected energy from a small surface area from illumination arriving from direction ˆL is proportional to the cosine of the angle between ˆL and the surface normal ˆN Ir Iicosθ θ ˆL I(Nˆ L) ˆ i 2/14/07 12

Computing diffuse reflection Constant of proportionality depends on surface properties I = k I(Nˆ L) ˆ r,d The constant k d specifies how much of the incident light I i is diffusely reflected When (Nˆ L) ˆ < 0 the incident light is blocked by the surface itself and the diffuse reflection is 0 d i diffuse reflection for varying light 2/14/07 13

Specular reflection Specular reflectors have a bright, view dependent highlight examples polished metal, glossy car finish, a mirror at the microscopic level a specular reflecting surface is very smooth Specular reflection obeys Snell s law: The incoming ray, the surface normal, and the reflected ray all lie in a common plane. The relationship between the angles of the incoming and reflected rays with the normal is given by: nsinθ = n sinθ i i o o ˆL θ i ˆN θ o ˆR n i and n o are the indices of refraction for the incoming and outgoing ray, respectively Reflection is a special case where n i = n o so θ o = θ i 2/14/07 14

Computing the reflection vector The vector R can be computed from the incoming light direction and the surface normal as shown below. Rˆ = (2(Nˆ Lˆ))Nˆ Lˆ The diagram below illustrates this relationship. ˆL ˆN ˆR 2(Nˆ L)N ˆ ˆ 2/14/07 15 ˆL

Non-ideal reflectors Snell s law applies only to ideal specular reflectors Real materials have microscopic surface variations that cause some of the light to be reflected in directions slightly offset from the the ideal reflected ray Causes highlight to spread out according to roughness Empirical models try to simulate the appearance of this effect, without trying to capture the physics of it ˆL ˆN ˆR 2/14/07 16

Phong illumination The Phong model is an empirical model one of the most commonly used illumination models in computer graphics has no physical basis I = k I(cos φ) r,s s i = ki(vˆ R) ˆ si n s n s ˆL ˆN ˆV φ ˆR (V) ˆ is the direction to the viewer (Vˆ R) ˆ is clamped to [0,1] The specular exponent n s controls how quickly the highlight falls off 2/14/07 17

Effect of specular exponent How the shape of the highlight changes with varying n s 2/14/07 18

Phong examples varying light direction varying specular exponent 2/14/07 19

Blinn & Torrance variation Jim Blinn introduced another approach for computing Phonglike illumination based on the work of Ken Torrance: I = k I(Nˆ H) ˆ r,s s i Lˆ Ĥ = Lˆ + Vˆ + Vˆ n s ˆL ˆN Ĥ ˆV Ĥis the half-way vector that bisects the light and viewer directions 2/14/07 20

Putting it all together numlights ( ˆ ˆ ˆ ˆ n ) I = k I + I k (N L ) + k (V R ) r a a i,j d j s j j= 1 s 2/14/07 21

OpenGL surface properties glmaterialfv(gl_front, GL_AMBIENT, ambientcolor) glmaterialfv(gl_front, GL_DIFFUSE, diffusecolor) glmaterialfv(gl_front, GL_SPECULAR, specularcolor) glmaterialfv(gl_front, GL_SHININESS, nshininess) 2/14/07 22

Where do we Illuminate? Illumination can be expensive requires computation and normalizing of vectors for multiple light sources Compute illumination for faces Use face normal If the light is directional then the diffuse contribution is constant across the facet If the eye is infinitely far away and the light is directional then the specular contribution is constant across the facet Compute illumination for vertices Use vertex normals. interpolate illumination across face Compute illumination at each pixel most accurate and expensive interpolate normal across face 2/14/07 23

Flat shading The simplest shading method applies only one illumination calculation per face called constant or flat shading Issues: For point light sources the light direction varies over the face For specular reflections the viewer direction varies over the facet Illumination usually computed at the centroid of the face: n 1 centroid = p n i = 1 i 2/14/07 24

Need for vertex normals Even when the illumination equation is applied at each pixel, the polygonal nature of the model is still apparent. To overcome this limitation normals are introduced at each vertex. Usually different than the polygon normal Used only for shading (not backface culling or other geometric computations) Better approximates the "real" surface 2/14/07 25

Vertex normals If vertex normals are not provided they can often be approximated by averaging the normals of the facets which share the vertex. n v This only works if the polygons reasonably approximate the underlying surface. k = n i= 1 face,i A better approximation can be found using a clustering analysis of the normals on the unit sphere. 2/14/07 26

Gouraud shading Gouraud shading applies the illumination model on a subset of surface points and interpolates the intensity of the remaining points on the surface. For a polygonal mesh the illumination model is usually applied at each vertex and linearly interpolated over the polygons Notice that facet artifacts are still visible. 2/14/07 27

Phong shading Phong shading (not to be confused with Phong s illumination model), the surface normal is linearly interpolated across polygonal facets, and the Illumination model is applied at every point. Phong shading will usually result in a very smooth appearance, however, evidence of the polygonal model can usually be seen along silhouettes. 2/14/07 28

Local illumination Local illumination models compute the colors of points on surfaces by considering only local properties the position of the point the surface properties the properties of any light sources that affect it No other objects in the scene are considered neither as light blockers nor as reflectors Typical of immediate-mode renders, such as OpenGL 2/14/07 29

Global Illumination In the real world, light takes indirect paths Light reflects off of other materials (possibly multiple objects) Light is blocked by other objects Light can be scattered Light can be focused Light can bend Harder to model At each point we must consider not only every light source, but and other point that might have reflected light toward it 2/14/07 30

Next time Illumination and shading physically-based models 2/14/07 31