CS Illumination and Shading. Slide 1

Similar documents
Introduction to Computer Graphics. Farhana Bandukwala, PhD Lecture 14: Light Interacting with Surfaces

CS5620 Intro to Computer Graphics

Illumination Models & Shading

Illumination and Shading

Illumination and Shading

Comp 410/510 Computer Graphics. Spring Shading

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

Illumination & Shading

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

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

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

Reflection and Shading

Introduction to Computer Graphics 7. Shading

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

Illumination & Shading I

Illumination in Computer Graphics

How do we draw a picture?

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

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

Visualisatie BMT. Rendering. Arjan Kok

Computer Graphics. Illumination and Shading

Shading. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller/Fuhrmann

Graphics for VEs. Ruth Aylett

CPSC 314 LIGHTING AND SHADING

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I

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

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

w Foley, Section16.1 Reading

Chapter 10. Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

CPSC / Illumination and Shading

CS 325 Computer Graphics

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

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

CS 4731: Computer Graphics Lecture 16: Phong Illumination and Shading. Emmanuel Agu

Graphics for VEs. Ruth Aylett

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

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

Objectives. Shading II. Distance Terms. The Phong Reflection Model

CEng 477 Introduction to Computer Graphics Fall

Simple Lighting/Illumination Models

Objectives. Continue discussion of shading Introduce modified Phong model Consider computation of required vectors

9. Illumination and Shading

CS 4600 Fall Utah School of Computing

Pipeline Operations. CS 4620 Lecture 10

Shading I Computer Graphics I, Fall 2008

University of Victoria CSC 305 Shading. Brian Wyvill 2016

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Shading Models. Simulate physical phenomena

CS 130 Final. Fall 2015

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Level of Details in Computer Rendering

Illumination and Shading

Shading II. CITS3003 Graphics & Animation

Lessons Learned from HW4. Shading. Objectives. Why we need shading. Shading. Scattering

Lighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

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

Shading II. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

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

Illumination & Shading: Part 1

CS770/870 Spring 2017 Color and Shading

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

Computer Vision Systems. Viewing Systems Projections Illuminations Rendering Culling and Clipping Implementations

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

Why we need shading?

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

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Shading. Brian Curless CSE 457 Spring 2017

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

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics V. Guoying Zhao 1 / 65

Lighting/Shading III. Week 7, Wed Mar 3

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading

Graphics and Visualization

Computer Graphics. Illumination and Shading

Computer Graphics: 3-Local Illumination Models

Shading Algorithms. Ron Goldman Department of Computer Science Rice University

Computer Graphics (CS 543) Lecture 8a: Per-Vertex lighting, Shading and Per-Fragment lighting

Shading. Shading = find color values at pixels of screen (when rendering a virtual 3D scene).

Lighting and Shading

CS452/552; EE465/505. Lighting & Shading

Shading 1: basics Christian Miller CS Fall 2011

Illumination Models and Surface-Rendering Methods. Chapter 10

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

Shading and Illumination

CS452/552; EE465/505. Intro to Lighting

Introduction to Visualization and Computer Graphics

Pipeline Operations. CS 4620 Lecture 14

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

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

Complex Shading Algorithms

Graphics and Interaction Surface rendering and shading

Lecture outline Graphics and Interaction Surface rendering and shading. Shading techniques. Introduction. Surface rendering and shading

Computer Graphics (CS 4731) Lecture 18: Lighting, Shading and Materials (Part 3)

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

Today we will start to look at illumination models in computer graphics

INF3320 Computer Graphics and Discrete Geometry

Virtual Reality for Human Computer Interaction

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Transcription:

CS 112 - Illumination and Shading Slide 1

Illumination/Lighting Interaction between light and surfaces Physics of optics and thermal radiation Very complex: Light bounces off several surface before reaching the eye Approximations are required Simple and at the same time believable Graphics pipeline uses such illumination models Slide 2

Illumination/Shading How does light interaction at any point of a surface to generate the color at that point? Illumination Evaluated only at triangle vertices From illumination generated at a set of sample points, how do we shade the whole surface Shading Shade planar triangles from the vertices Slide 3

Lighting at a point on surface Do NOT think of triangulated surfaces All vectors are unit vectors Monochromatic light L Angle of Incidence θ N R V α θ Angle of Reflectance P Surface Slide 4

Ambient Lighting Diffuse non-directional source of light Sends equal amount of light in all direction Ambient light Result of multiple reflections from multiple surfaces Impinges equal light from all direction equally on all surfaces Slide 5

Ambient Lighting I = I a k a I a = intensity of ambient light k a = percentage of the light reflected by the object Coefficient of ambient reflection Slide 6

Diffused Lighting Point light sources: Illumination varies with Distance of the light from the surface Orientation of the light with respect to the surface Equal amount of light reflected in all direction Independent of viewer location Slide 7

Lighting at a point on surface R cosθ I = I p k d cosθ I p = intensity of light k d = coefficient of diffuse reflection I = I p k d (N.L) L N R If light is at infinity, L is constant over the whole surface θ P θ Surface Slide 8

Ambient and Diffused Lighting I = I p k d (N.L) I = (I a k a +I p k d (N.L)) Slide 9

Diffuse Lighting Did not take distance of the source from surface into account I = I p f att k d (N.L) f att = 1/(a+bd+cd 2 ) d = distance of light from the surface a, b and c are user defined constants Slide 10

Attenuation of Light a=0, b=0, c=1 a=0.25, b=0.25, c=0.5 a=0, b=1, c=0 Increasing distance from the light source Slide 11

Specular Lighting Observed on shiny surfaces Amount of reflection changes with viewpoint Think of a mirror, perfectly specular Phong Illumination Model L R L R Slide 12

Phong Illumination Model L R I p k s Cos n (α) Cos(α): fall off as V moves away from R θ P θ α V n gives the sharpness Slide 13

Phong Illumination Model S = Ncosθ - L R = Ncosθ + S = 2Ncosθ L = 2N(N.L) L cos(α) = R.V = (2N(N.L) L).V Slide 14

Chromatic Light Ambient Light : (I ar, I ag, I ab ) Point (I pr, I pg, I pb ) May have diffused and specular components (I dr, I dg, I db ) and (I sr, I sg, I sb ) Object s color by a RGB value: (O R, O G, O B ) Can have ambient, diffuse and specular components (O ar, O ag, O ab ), (O dr, O dg, O db ), (O sr, O sg, O sb ) Slide 15

Chromatic Light Each channel treated independent Ambient : I ac k a O C Diffuse: f att I pc k d O C (N.L) Specular: I pc k s (R.V)O C Total for each channel O C (I ac k a + f att I pc k d (N.L)+ I pc k s (R.V)) Different components O ac I ac + f att O dc I dc (N.L)+ O sc I sc (R.V) Slide 16

Multiple Light sources Only one ambient light source Multiple point light sources Addition of light from different light sources Slide 17

Ambient Slide 18

Ambient + Diffuse Slide 19

Ambient + Diffuse + Specular Slide 20

What is Shading? Illumination model How do we use these models to shade the triangles in the graphics pipeline? How did we generate the picture on the right? Slide 21

Method Evaluate illumination model at the vertices of the triangles After model-view transformation Use interpolation to color the interior of the triangles during rasterization Different shading methods use different interpolation Assume that the polygonal models approximate smooth surfaces Slide 22

Normal Computation Normal of a triangle N = (B-A) x (C-A) Vertices are in anticlockwise direction with respect to normal Normal of a vertex Average of all the triangle incident on the vertex N v = (N 1 +N 2 +N 3 +N 4 )/4 B A N C Slide 23

Constant/Flat/Faceted Shading Illumination model applied once per triangle Using normal of the triangle Shade the whole triangle uniformly Color associated with triangles and not vertices Slide 24

Validity Light is at infinity N.L is constant over the plane of the triangle Viewer is at infinity R.V is constant over the plane of the triangle Polygonal surface represents the actual surface being modeled Not true Shading is not continuous at edges Slide 25

Gouraud Shading Interpolating illumination between vertices Calculate the illumination using vertex normals at vertices Bilinear interpolation across the triangle Slide 26

Gouraud Shading Edges get same color, irrespective of which triangle they are rendered from Shading is continuous at edges Tends to spread sharp illumination spots over the triangle Slide 27

Phong Shading Interpolate the normal across the triangle Calculate the illumination at every pixel during rasterization Using the interpolated normal Slower than Gouraud Does not miss specular highlights Good for shiny specular objects Slide 28

Gouraud vs. Phong Shading Gouraud Phong Gouraud Phong Spreads highlights across the triangle Misses a highlight completely Slide 29

Flat Shading Slide 30

Gouraud Shading Slide 31

Phong Shading Slide 32

Shading Independent of the Illumination model used Phong Shading and Phong Illumination Artifacts Piecewise planar approximation Screen Space Interpolation Simple and hence widely used Slide 33

Artifacts: Mach Bands At discontinuities Actual Intensity Percieved Intensity Slide 34

Artifacts: Mach Bands Common in flat shading since shading is discontinuous at edges Also present in Gouraud shading Gradient of the shading may change suddenly Phong shading reduces it significantly But cannot be eliminated At sharp changes in surface gradient Slide 35

Artifacts: Screen Space Interpolation S 1 Shading is interpolated while rasterization S p = (S 1 +S 2 )/2 z s = (z 1 +z 2 )/2 S 2 S p Slide 36

Artifacts: T-junctions The shading at the T-junction are different when calculated from different triangles Shading discontinuity B A D C Slide 37

Artifacts:Vertex Normals Vertex normal does not reflect the curvature of the surface adequately Appear more flat than it actually is Slide 38