Shading Algorithms. Ron Goldman Department of Computer Science Rice University

Size: px
Start display at page:

Download "Shading Algorithms. Ron Goldman Department of Computer Science Rice University"

Transcription

1 Shading Algorithms Ron Goldman Department of Computer Science Rice University

2 Illumination and Shading Standard Assumptions Curved surfaces are approximated by planar polygons. All light sources are point light sources (at infinity). Illumination Models Ambient Light Diffuse Reflection (Scattering) Specular Reflection Shading Models Uniform (Flat) Gouraud Phong

3 Shading Algorithms Uniform -- constant intensity for each polygon (Flat) Gouraud -- linear interpolation of intensity for each polygon along scan lines Phong -- linear interpolation of normal vectors (non-linear interpolation of intensity) for each polygon along scan lines Coordinate Dependent Methods Speed vs. Generality

4 Uniform Shading Assumptions 1. The surfaces really are polygonal. N = surface normal = constant 2. Light source at infinity L = vector to light source = constant L N = constant R = 2(L N)N L = constant 3. Eye at infinity V = vector to eye = constant N V = constant R V = constant

5 Polygon Normals Normal to a Polygon N = (P k O) (P k +1 O) = P k P k +1 P k O + P k +1 O Newell s Formula m N = P k P k +1 k =0 N = 2 Area(Polygon) (Green s Theorem) Avoids problem of collinear vertices P 2 P1 P 3 O

6 Uniform Shading (continued) Intensity I uniform = { I a k a + I pk d (L N) ambient diffuse + I p k s (R V) n specular N, L, R,V constant I uniform constant along each polygon L N R V θ θ α Surface Mach Bands Discontinuities in intensity along polygon edges. Individual polygons highly visible. Heightened by physiological effects of the eye.

7 Purpose To Reduce Mach Bands Gouraud Shading Method Linear Interpolation of Intensities Incremental Computations -- Only One Addition per Pixel (Fast!) Strategy 1. Compute intensity at vertices, using an average unit normal vector. N vertex = vertex Polygon N polygon vertex Polygon N polygon (Normalized Average) 2. Interpolate intensity along edges. 3. Interpolate intensity along scan lines. Observation Polygon intensities agree along common edges. Integrates well with hidden surface scan line algorithm.

8 Polygon Vertex Edge Vertex Edge Vertex Scan Line Scan Line Edge Edge Vertex Vertex Vertex Edge Edge

9 Linear Interpolation Points Intensities L(t) = (1 t)p 1 + tp 2 I(t) = (1 t)i 1 + ti 2 L(t) = P 1 + t(p 2 P 1 ) I(t) = I 1 + t(i 2 I 1 ) L(t + Δt) = P 1 +(t + Δt)(P 2 P 1 ) I(t + Δt) = I 1 +(t + Δt)(I 2 I 1 ) ΔL = Δt(P 2 P 1 ) ΔI = Δt(I 2 I 1 ) Δx = Δt(x 2 x 1 ) I new = I old + ΔI Δy = Δt(y 2 y 1 ) Δz = Δt(z 2 z 1 ) Observation: If we know Δt, then we can compute ΔI.

10 Along a Scan Line Incremental Intensity Computation } I 1 Δx = 1 I 2 P 1 = (x 1, y 1,z 1 ) P 2 = (x 2, y 2, z 2 ) (x, y, z) (x + Δx, y + Δy, z + Δz) Δx = 1 Δt = 1/(x 2 x 1 ) ΔI = (I 2 I 1 )Δt = (I 2 I 1 )/(x 2 x 1 ) Next Scan Line I 2 I 1 P 1 = (x 1, y 1,z 1 ) (x, y, z) (x + Δx, y + Δy, z + Δz) P 2 = (x 2, y 2, z 2 ) Δy =1 Δt =1/(y 2 y 1 ) { ΔI = (I 2 I 1 )Δt = (I 2 I 1 )/(y 2 y 1 ) Δy =1

11 Orientation Dependence and Independence Problem Gouraud (Phong) Shading is Orientation Dependent Solution Subdivide the Polygons into Triangles Gouraud (Phong) Shading for Triangles is Orientation Independent Note Shading Algorithm Depends on the Particular Triangular Subdivision Shading Algorithm Gives Different Results for Different Subdivisions

12 Coordinate Dependence White White White White All White White Not All White Gray Black White Black

13 Barycentric Coordinates and Coordinate Independence (1 t)i 1 +ti 2 I 1 (1 s)i 1 + si 3 I I 2 I 3 β 3 I 1 β 2 I β 1 I 2 I 3 I = (1 u) ((1 t)i 1 +ti 2 ) +u ((1 s)i 1 + si 3 ) I = β 1 I 1 +β 2 I 2 + β 3 I 3 ( ) I = (1 u)(1 t)+u(1 s) I (1 u)t I 2 +(us) { I 3 β 1 ( ) β 2 β 3 Barycentric Coordinates β 1 +β 2 +β 3 =1 P = β 1 P 1 + β 2 P 2 +β 3 P 3 = P 1 + β 2 (P 2 P 1 )+β 3 (P 3 P 1 ) β 1,β 2,β 3 unique

14 Purpose To Reduce Mach Bands To Mimic Curved Surfaces Naive Phong Shading Method Linear Interpolation of Normal Vectors Incremental Computation of Normal Vectors Strategy 1. Compute unit normals at vertices by averaging the unit normals of the polygons to which the vertex belongs. N vertex = vertex Polygon N polygon vertex Polygon N polygon (Normalized Average) 2. Interpolate normals along edges. (Renormalize) 3. Interpolate normals along scan lines. (Renormalize) 4. Use normals to calculate intensities.

15 Linear Interpolation Points Normals L(t) = (1 t)p 1 + tp 2 N(t) = (1 t)n 1 + tn 2 L(t) = P 1 + t(p 2 P 1 ) N(t) = N 1 + t(n 2 N 1 ) L(t + Δt) = P 1 +(t + Δt)(P 2 P 1 ) N(t + Δt) = N 1 + (t + Δt)(N 2 N 1 ) ΔL = Δt(P 2 P 1 ) ΔN = Δt(N 2 N 1 ) Δx = Δt(x 2 x 1 ) N new = N old + ΔN N old + ΔN Δy = Δt(y 2 y 1 ) Δz = Δt(z 2 z 1 ) Observation: If we know Δt, then we can compute ΔN.

16 Along a Scan Line Incremental Normal Computation } N 1 Δx = 1 N 2 P 1 = (x 1, y 1,z 1 ) P 2 = (x 2, y 2, z 2 ) (x, y, z) (x + Δx, y + Δy, z + Δz) Δx = 1 Δt = 1/(x 2 x 1 ) ΔN = (N 2 N 1 )Δt = (N 2 N 1 )/(x 2 x 1 ) Next Scan Line N 2 N 1 P 1 = (x 1, y 1,z 1 ) (x, y, z) (x + Δx, y + Δy, z + Δz) P 2 = (x 2, y 2, z 2 ) Δy =1 Δt =1/(y 2 y 1 ) { Δy =1 ΔN = (N 2 N 1 )Δt = (N 2 N 1 )/(y 2 y 1 )

17 Clever Implementation -- Diffuse Reflection Diffuse Reflection I diffuse = I p k d (L N) = I p k d (1 t)(l N 1 )+t(l N 2 ) (1 t)n 1 +t N 2 J(t) = (1 t)(l 12 N 43 1 ) +t(l 14 2 N 43 2) J 1 J 2 -- Similar to Gouraud (Scalars) -- Avoids Dot Products Along Scan Lines N(t) = (1 t)n 1 +t N 2 -- N next = N current +ΔN -- Update Normal Vector Incrementally -- d next = N next = N next N next -- Normalization by Newton s Method

18 Normalization by Newton s Method Square Root by Newton s Method x 2 2 d next = 0 -- x 0 = d current -- x n+1 = x n x n 2 d next 2 2x n

19 Clever Implementation -- Specular Reflection Specular Reflection I specular = I p k s (RV) n -- R = 2(L N)N L I specular = I p k s ( 2(L N)(N V ) (L V)) n -- N = (1 t)n 1 +t N 2 2 {(1 t)(l N 1 )+t(l N 2 )} {(1 t)(v N )+t(v N 2 )} Similar to Gouraud Similar to Gouraud I specular = I p k s 2 (1 t)n 1 +t N 2 (LV 12 3 ) Constant n -- (1 t)n 1 +t N 2 2 = N + ΔN 2 = (N + ΔN)(N +ΔN) -- No Square Root

20 Spherical Linear Interpolation Slerp slerp(n 1,N 2,t) = sin ((1 t)φ) sin( tφ) N 1 + sin(φ) sin(φ) N 2 cos(φ) = N 1 N 2 -- sin(φ) = 1 (N 1 N 2 ) 2 slerp maps unit vectors to unit vectors more natural than linear interpolation -- avoids square roots Expand incrementally Expand Δsine and Δcosine Precompute sin(δtφ) and cos(δt φ)

21 Interpolating Unit Vectors Vector Interpolation Problem N 1 N t φ tφ N 0 N 0, N 1 = unit vectors Vector Interpolation Formula N t = sin ((1 t)φ) sin( tφ) N 0 + sin(φ) sin(φ) N 1

22 Incremental Spherical Linear Interpolation Slerp slerp(n 1,N 2,t) = sin ((1 t)φ) sin( tφ) N 1 + sin(φ) sin(φ) N 2 cos(φ) = N 1 N 2 sin(φ) = 1 (N 1 N 2 ) 2 Incremental Computation slerp(n 1,N 2,t +Δt) = sin ((1 t Δt)φ ) N 1 + sin(φ) sin ((t +Δt)φ) N 2 sin(φ) -- sin ((t +Δt)φ ) = sin(tφ)cos(δtφ)+ cos(tφ)sin(δtφ) -- sin ((1 t Δt)φ) = sin((1 t )φ)cos(δt φ) cos((1 t)φ)sin(δt φ) -- cos ((t + Δt)φ) = cos(tφ)cos(δtφ) sin(tφ)sin(δtφ) -- cos ((1 t Δt)φ ) = cos((1 t )φ)cos(δt φ)+sin((1 t)φ)sin(δt φ)

23 Fast Phong Shading with SLERP Diffuse Reflection I diffuse = I p k d (L N) = I p k d sin(φ) ( sin ((1 t)φ ) L N 1 +sin( tφ) L N 2 ) Specular Reflection I specular = I p k s (RV) n -- R = 2(L N)N L I specular = I p k s ( 2(L N)(N V ) (L V)) n 2 I specular = I p k s sin 2 (φ) ( ) sin (1 t)φ sin ( (1 t)φ )L N 1 + sin( tφ)l N 2 ( ( )V N 1 + sin( tφ)v N 2 ) (L 12 V) 3 Constant n

24 Comparison to Gouraud Shading Similar to Gouraud Shading Intensity calculations replaced by normal calculations Integrates well with hidden surface scan line algorithm Coordinate dependent method Slower than Gouraud Shading Intensities must be recalculated at each point from the normal vector I = { I a k a + I pk d (L N) ambient diffuse + I p k s (R V) n N is different for each point R is different for each point specular More Accurate than Gouraud Shading Simulates curved surfaces (varying normal vectors) Further reduces Mach Bands Tighter highlights (and spotlights) than Gouraud shading Gouraud shading interpolates intensities -- smoothes out highlights

25 Problems with Gouraud and Phong Shading Orientation Dependence Problem: Linear Interpolation for Polygons is Orientation Dependent Visual Effect: Shading Changes Abruptly During Animation Solution: Subdivide into Triangles

Lecture 21: Shading. put your trust in my shadow. Judges 9:15

Lecture 21: Shading. put your trust in my shadow. Judges 9:15 Lecture 21: Shading put your trust in my shadow. Judges 9:15 1. Polygonal Models Polygonal models are one of the most common representations for geometry in Computer Graphics. Polygonal models are popular

More information

CS5620 Intro to Computer Graphics

CS5620 Intro to Computer Graphics So Far wireframe hidden surfaces Next step 1 2 Light! Need to understand: How lighting works Types of lights Types of surfaces How shading works Shading algorithms What s Missing? Lighting vs. Shading

More information

Illumination and Shading

Illumination and Shading Illumination and Shading Illumination (Lighting)! Model the interaction of light with surface points to determine their final color and brightness! The illumination can be computed either at vertices or

More information

CS Illumination and Shading. Slide 1

CS Illumination and Shading. Slide 1 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

More information

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

Shading. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller/Fuhrmann Shading Introduction to Computer Graphics Torsten Möller Machiraju/Zhang/Möller/Fuhrmann Reading Chapter 5.5 - Angel Chapter 6.3 - Hughes, van Dam, et al Machiraju/Zhang/Möller/Fuhrmann 2 Shading Illumination

More information

How do we draw a picture?

How do we draw a picture? 1 How do we draw a picture? Define geometry. Now what? We can draw the edges of the faces. Wireframe. We can only draw the edges of faces that are visible. We can fill in the faces. Giving each object

More information

9. Illumination and Shading

9. Illumination and Shading 9. Illumination and Shading Approaches for visual realism: - Remove hidden surfaces - Shade visible surfaces and reproduce shadows - Reproduce surface properties Texture Degree of transparency Roughness,

More information

Illumination Models & Shading

Illumination Models & Shading Illumination Models & Shading Lighting vs. Shading Lighting Interaction between materials and light sources Physics Shading Determining the color of a pixel Computer Graphics ZBuffer(Scene) PutColor(x,y,Col(P));

More information

Visualisatie BMT. Rendering. Arjan Kok

Visualisatie BMT. Rendering. Arjan Kok Visualisatie BMT Rendering Arjan Kok a.j.f.kok@tue.nl 1 Lecture overview Color Rendering Illumination 2 Visualization pipeline Raw Data Data Enrichment/Enhancement Derived Data Visualization Mapping Abstract

More information

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

Rendering. Illumination Model. Wireframe rendering simple, ambiguous Color filling flat without any 3D information llumination Model Wireframe rendering simple, ambiguous Color filling flat without any 3D information Requires modeling interaction of light with the object/surface to have a different color (shade in

More information

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation Lecture 17: Shading in OpenGL CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL shading methods - per vertex shading

More information

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014 ECS 175 COMPUTER GRAPHICS Ken Joy Winter 2014 Shading To be able to model shading, we simplify Uniform Media no scattering of light Opaque Objects No Interreflection Point Light Sources RGB Color (eliminating

More information

University of Victoria CSC 305 Shading. Brian Wyvill 2016

University of Victoria CSC 305 Shading. Brian Wyvill 2016 University of Victoria CSC 305 Shading Brian Wyvill 2016 The illuminating Hemisphere Energy and Intensity Energy is the intensity integrated over the solid angle through which it acts. Intensity is not

More information

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

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading Objectives Shading in OpenGL Introduce the OpenGL shading methods - per vertex shading vs per fragment shading - Where to carry out Discuss polygonal shading - Flat - Smooth - Gouraud CITS3003 Graphics

More information

Mach band effect. The Mach band effect increases the visual unpleasant representation of curved surface using flat shading.

Mach band effect. The Mach band effect increases the visual unpleasant representation of curved surface using flat shading. Mach band effect The Mach band effect increases the visual unpleasant representation of curved surface using flat shading. A B 320322: Graphics and Visualization 456 Mach band effect The Mach band effect

More information

Graphics and Interaction Surface rendering and shading

Graphics and Interaction Surface rendering and shading 433-324 Graphics and Interaction Surface rendering and shading Department of Computer Science and Software Engineering The Lecture outline Introduction Surface rendering and shading Gouraud shading Phong

More information

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

Lecture outline Graphics and Interaction Surface rendering and shading. Shading techniques. Introduction. Surface rendering and shading Lecture outline 433-324 Graphics and Interaction Surface rendering and shading Department of Computer Science and Software Engineering The Introduction Surface rendering and shading Gouraud shading Phong

More information

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

Computer Vision Systems. Viewing Systems Projections Illuminations Rendering Culling and Clipping Implementations Computer Vision Systems Viewing Systems Projections Illuminations Rendering Culling and Clipping Implementations Viewing Systems Viewing Transformation Projective Transformation 2D Computer Graphics Devices

More information

Illumination and Shading

Illumination and Shading Illumination and Shading Light sources emit intensity: assigns intensity to each wavelength of light Humans perceive as a colour - navy blue, light green, etc. Exeriments show that there are distinct I

More information

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

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading) Lecture 9 Graphics pipeline (rasterization and shading) Graphics pipeline - part 1 (recap) Perspective projection by matrix multiplication: x pixel y pixel z canonical 1 x = M vpm per M cam y z 1 This

More information

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

Computer Graphics. Shading. Based on slides by Dianna Xu, Bryn Mawr College Computer Graphics Shading Based on slides by Dianna Xu, Bryn Mawr College Image Synthesis and Shading Perception of 3D Objects Displays almost always 2 dimensional. Depth cues needed to restore the third

More information

Illumination and Shading

Illumination and Shading Illumination and Shading Illumination and Shading z Illumination Models y Ambient y Diffuse y Attenuation y Specular Reflection z Interpolated Shading Models y Flat, Gouraud, Phong y Problems CS4451: Fall

More information

Shading Techniques Denbigh Starkey

Shading Techniques Denbigh Starkey Shading Techniques Denbigh Starkey 1. Summary of shading techniques 2 2. Lambert (flat) shading 3 3. Smooth shading and vertex normals 4 4. Gouraud shading 6 5. Phong shading 8 6. Why do Gouraud and Phong

More information

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

Introduction to Computer Graphics. Farhana Bandukwala, PhD Lecture 14: Light Interacting with Surfaces Introduction to Computer Graphics Farhana Bandukwala, PhD Lecture 14: Light Interacting with Surfaces Outline Computational tools Reflection models Polygon shading Computation tools Surface normals Vector

More information

Rendering Light Reflection Models

Rendering Light Reflection Models Rendering Light Reflection Models Visual Imaging in the Electronic Age Donald P. Greenberg October 3, 2017 Lecture #13 Program of Computer Graphics, Cornell University General Electric - 167 Cornell in

More information

w Foley, Section16.1 Reading

w Foley, Section16.1 Reading Shading w Foley, Section16.1 Reading Introduction So far, we ve talked exclusively about geometry. w What is the shape of an object? w How do I place it in a virtual 3D space? w How do I know which pixels

More information

CEng 477 Introduction to Computer Graphics Fall

CEng 477 Introduction to Computer Graphics Fall Illumination Models and Surface-Rendering Methods CEng 477 Introduction to Computer Graphics Fall 2007 2008 Illumination Models and Surface Rendering Methods In order to achieve realism in computer generated

More information

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 Orthogonal Projection Matrices 1 Objectives Derive the projection matrices used for standard orthogonal projections Introduce oblique projections Introduce projection normalization 2 Normalization Rather

More information

Computer Graphics. Illumination and Shading

Computer Graphics. Illumination and Shading Rendering Pipeline modelling of geometry transformation into world coordinates placement of cameras and light sources transformation into camera coordinates backface culling projection clipping w.r.t.

More information

Reflection and Shading

Reflection and Shading Reflection and Shading R. J. Renka Department of Computer Science & Engineering University of North Texas 10/19/2015 Light Sources Realistic rendering requires that we model the interaction between light

More information

Homework #2. Shading, Ray Tracing, and Texture Mapping

Homework #2. Shading, Ray Tracing, and Texture Mapping Computer Graphics Prof. Brian Curless CSE 457 Spring 2000 Homework #2 Shading, Ray Tracing, and Texture Mapping Prepared by: Doug Johnson, Maya Widyasari, and Brian Curless Assigned: Monday, May 8, 2000

More information

CPSC / Illumination and Shading

CPSC / Illumination and Shading CPSC 599.64 / 601.64 Rendering Pipeline usually in one step modelling of geometry transformation into world coordinate system placement of cameras and light sources transformation into camera coordinate

More information

Dithering and Rendering. CS116B Chris Pollett Apr 18, 2004.

Dithering and Rendering. CS116B Chris Pollett Apr 18, 2004. Dithering and Rendering CS116B Chris Pollett Apr 18, 2004. Outline Dithering Techniques Constant-Intensity Surface Rendering Gouraud Surface Rendering Phong Surface Rendering Fast Phong Surface Rendering

More information

CS770/870 Spring 2017 Color and Shading

CS770/870 Spring 2017 Color and Shading Preview CS770/870 Spring 2017 Color and Shading Related material Cunningham: Ch 5 Hill and Kelley: Ch. 8 Angel 5e: 6.1-6.8 Angel 6e: 5.1-5.5 Making the scene more realistic Color models representing the

More information

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

Computer Graphics (CS 543) Lecture 8a: Per-Vertex lighting, Shading and Per-Fragment lighting Computer Graphics (CS 543) Lecture 8a: Per-Vertex lighting, Shading and Per-Fragment lighting Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Computation of Vectors To calculate

More information

CS 130 Final. Fall 2015

CS 130 Final. Fall 2015 CS 130 Final Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

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

CS 4731: Computer Graphics Lecture 16: Phong Illumination and Shading. Emmanuel Agu CS 4731: Computer Graphics Lecture 16: Phong Illumination and Shading Emmanuel Agu Recall: Setting Light Property Define colors and position a light GLfloat light_ambient[] = {0.0, 0.0, 0.0, 1.0}; GLfloat

More information

Computer Graphics MTAT Raimond Tunnel

Computer Graphics MTAT Raimond Tunnel Computer Graphics MTAT.03.015 Raimond Tunnel The Road So Far... Last week This week Color What is color? Color We represent color values with 3 channels: Red Green Blue Color We represent color values

More information

Comp 410/510 Computer Graphics. Spring Shading

Comp 410/510 Computer Graphics. Spring Shading Comp 410/510 Computer Graphics Spring 2017 Shading Why we need shading Suppose we build a model of a sphere using many polygons and then color it using a fixed color. We get something like But we rather

More information

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Lecture 15: Shading-I. CITS3003 Graphics & Animation Lecture 15: Shading-I CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Learn that with appropriate shading so objects appear as threedimensional

More information

Introduction to Visualization and Computer Graphics

Introduction to Visualization and Computer Graphics Introduction to Visualization and Computer Graphics DH2320, Fall 2015 Prof. Dr. Tino Weinkauf Introduction to Visualization and Computer Graphics Visibility Shading 3D Rendering Geometric Model Color Perspective

More information

Shading and Illumination

Shading and Illumination Shading and Illumination OpenGL Shading Without Shading With Shading Physics Bidirectional Reflectance Distribution Function (BRDF) f r (ω i,ω ) = dl(ω ) L(ω i )cosθ i dω i = dl(ω ) L(ω i )( ω i n)dω

More information

CPSC 314 LIGHTING AND SHADING

CPSC 314 LIGHTING AND SHADING CPSC 314 LIGHTING AND SHADING UGRAD.CS.UBC.CA/~CS314 slide credits: Mikhail Bessmeltsev et al 1 THE RENDERING PIPELINE Vertices and attributes Vertex Shader Modelview transform Per-vertex attributes Vertex

More information

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

surface: reflectance transparency, opacity, translucency orientation illumination: location intensity wavelength point-source, diffuse source walters@buffalo.edu CSE 480/580 Lecture 18 Slide 1 Illumination and Shading Light reflected from nonluminous objects depends on: surface: reflectance transparency, opacity, translucency orientation illumination:

More information

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

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows Recollection Models Pixels Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows Can be computed in different stages 1 So far we came to Geometry model 3 Surface

More information

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

Lessons Learned from HW4. Shading. Objectives. Why we need shading. Shading. Scattering Lessons Learned from HW Shading CS Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Only have an idle() function if something is animated Set idle function to NULL, when

More information

Shading I Computer Graphics I, Fall 2008

Shading I Computer Graphics I, Fall 2008 Shading I 1 Objectives Learn to shade objects ==> images appear threedimensional Introduce types of light-material interactions Build simple reflection model Phong model Can be used with real time graphics

More information

Interpolation using scanline algorithm

Interpolation using scanline algorithm Interpolation using scanline algorithm Idea: Exploit knowledge about already computed color values. Traverse projected triangle top-down using scanline. Compute start and end color value of each pixel

More information

Illumination and Shading

Illumination and Shading Illumination and Shading Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL computes illumination at vertices illumination Shading

More information

Graphics Hardware and Display Devices

Graphics Hardware and Display Devices Graphics Hardware and Display Devices CSE328 Lectures Graphics/Visualization Hardware Many graphics/visualization algorithms can be implemented efficiently and inexpensively in hardware Facilitates interactive

More information

Graphics for VEs. Ruth Aylett

Graphics for VEs. Ruth Aylett Graphics for VEs Ruth Aylett Overview VE Software Graphics for VEs The graphics pipeline Projections Lighting Shading Runtime VR systems Two major parts: initialisation and update loop. Initialisation

More information

Pipeline Operations. CS 4620 Lecture 10

Pipeline Operations. CS 4620 Lecture 10 Pipeline Operations CS 4620 Lecture 10 2008 Steve Marschner 1 Hidden surface elimination Goal is to figure out which color to make the pixels based on what s in front of what. Hidden surface elimination

More information

CS 130 Exam I. Fall 2015

CS 130 Exam I. Fall 2015 S 3 Exam I Fall 25 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM NAME: Login name: Computer Science 46 Midterm 3//4, :3PM-:5PM This test is 5 questions, of equal weight. Do all of your work on these pages (use the back for scratch space), giving the answer in the space

More information

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

Illumination Model. The governing principles for computing the. Apply the lighting model at a set of points across the entire surface. Illumination and Shading Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL computes illumination at vertices illumination Shading

More information

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

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1 Today s class Simple shadows Shading Lighting in OpenGL Wednesday, November 21, 27 Computer Graphics - Class 1 1 Simple shadows Simple shadows can be gotten by using projection matrices Consider a light

More information

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

Lighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 Lighting and Shading II 1 Objectives Continue discussion of shading Introduce modified Phong model Consider computation of required vectors 2 Ambient Light Ambient light is the result of multiple interactions

More information

CS 325 Computer Graphics

CS 325 Computer Graphics CS 325 Computer Graphics 04 / 02 / 2012 Instructor: Michael Eckmann Today s Topics Questions? Comments? Illumination modelling Ambient, Diffuse, Specular Reflection Surface Rendering / Shading models Flat

More information

CS Surface Rendering

CS Surface Rendering CS10101001 Surface Rendering Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Surface rendering How do we choose a color

More information

Rasterizing triangles

Rasterizing triangles Rasterizing triangles We know how to project the vertices of a triangle in our model onto pixel centers. To draw the complete triangle, we have to decide which pixels to turn on. For now, let s assume

More information

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

Topic 9: Lighting & Reflection models 9/10/2016. Spot the differences. Terminology. Two Components of Illumination. Ambient Light Source Topic 9: Lighting & Reflection models Lighting & reflection The Phong reflection model diffuse component ambient component specular component Spot the differences Terminology Illumination The transport

More information

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

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL Computer Graphics Chapter 10 llumination Models and Surface-Rendering Methods Somsak Walairacht, Computer Engineering, KMTL Outline Light Sources Surface Lighting Effects Basic llumination Models Polygon

More information

Temporal Face Normal Interpolation

Temporal Face Normal Interpolation Temporal Face Normal Interpolation Jindřich Parus Centre of Computer Graphics and Data Visualization, University of West Bohemia, Pilsen, Czech Republic Anders Hast Creative Media Lab, University of Gävle,

More information

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

Topic 9: Lighting & Reflection models. Lighting & reflection The Phong reflection model diffuse component ambient component specular component Topic 9: Lighting & Reflection models Lighting & reflection The Phong reflection model diffuse component ambient component specular component Spot the differences Terminology Illumination The transport

More information

Introduction to Computer Graphics 7. Shading

Introduction to Computer Graphics 7. Shading Introduction to Computer Graphics 7. Shading National Chiao Tung Univ, Taiwan By: I-Chen Lin, Assistant Professor Textbook: Hearn and Baker, Computer Graphics, 3rd Ed., Prentice Hall Ref: E.Angel, Interactive

More information

CSE Intro to Computer Graphics. ANSWER KEY: Midterm Examination. November 18, Instructor: Sam Buss, UC San Diego

CSE Intro to Computer Graphics. ANSWER KEY: Midterm Examination. November 18, Instructor: Sam Buss, UC San Diego CSE 167 - Intro to Computer Graphics ANSWER KEY: Midterm Examination November 18, 2003 Instructor: Sam Buss, UC San Diego Write your name or initials on every page before beginning the exam. You have 75

More information

Light Reflection Models

Light Reflection Models Light Reflection Models Visual Imaging in the Electronic Age Donald P. Greenberg October 21, 2014 Lecture #15 Goal of Realistic Imaging From Strobel, Photographic Materials and Processes Focal Press, 186.

More information

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CSE528 Computer Graphics: Theory, Algorithms, and Applications CSE528 Computer Graphics: Theory, Algorithms, and Applications Hong Qin State University of New York at Stony Brook (Stony Brook University) Stony Brook, New York 11794--4400 Tel: (631)632-8450; Fax: (631)632-8334

More information

Lighting and Shading

Lighting and Shading Lighting and Shading Today: Local Illumination Solving the rendering equation is too expensive First do local illumination Then hack in reflections and shadows Local Shading: Notation light intensity in,

More information

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic. Shading Models There are two main types of rendering that we cover, polygon rendering ray tracing Polygon rendering is used to apply illumination models to polygons, whereas ray tracing applies to arbitrary

More information

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

Reading. Shading. An abundance of photons. Introduction. Required: Angel , 6.5, Optional: Angel 6.4 OpenGL red book, chapter 5. Reading Required: Angel 6.1-6.3, 6.5, 6.7-6.8 Optional: Shading Angel 6.4 OpenGL red book, chapter 5. 1 2 Introduction An abundance of photons So far, we ve talked exclusively about geometry. Properly

More information

Shading Models. Simulate physical phenomena

Shading Models. Simulate physical phenomena Illumination Models & Shading Shading Models Simulate hysical henomena Real illumination simulation is comlicated & exensive Use aroximation and heuristics with little hysical basis that looks surrisingly

More information

Rendering Light Reflection Models

Rendering Light Reflection Models Rendering Light Reflection Models Visual Imaging in the Electronic Age Donald P. Greenberg October 27, 2015 Lecture #18 Goal of Realistic Imaging The resulting images should be physically accurate and

More information

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

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models Computergrafik Thomas Buchberger, Matthias Zwicker Universität Bern Herbst 2008 Today Introduction Local shading models Light sources strategies Compute interaction of light with surfaces Requires simulation

More information

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

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

More information

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

Reading. Shading. Introduction. An abundance of photons. Required: Angel , Optional: OpenGL red book, chapter 5. Reading Required: Angel 6.1-6.5, 6.7-6.8 Optional: Shading OpenGL red book, chapter 5. 1 2 Introduction So far, we ve talked exclusively about geometry. What is the shape of an obect? How do I place it

More information

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

Objectives. Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading. Shading II 1 Objectives Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading Flat Smooth Gouraud 2 Phong Lighting Model A simple model

More information

Illumination & Shading

Illumination & Shading Illumination & Shading Goals Introduce the types of light-material interactions Build a simple reflection model---the Phong model--- that can be used with real time graphics hardware Why we need Illumination

More information

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010 Computer Graphics 1 Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering 1 The 3D rendering pipeline (our version for this class) 3D models in model coordinates 3D models in world coordinates 2D Polygons

More information

Chapter 7 - Light, Materials, Appearance

Chapter 7 - Light, Materials, Appearance Chapter 7 - Light, Materials, Appearance Types of light in nature and in CG Shadows Using lights in CG Illumination models Textures and maps Procedural surface descriptions Literature: E. Angel/D. Shreiner,

More information

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

Chapter 10. Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL Computer Graphics Chapter 10 llumination Models and Surface-Rendering Methods Somsak Walairacht, Computer Engineering, KMTL 1 Outline Light Sources Surface Lighting Effects Basic llumination Models Polygon

More information

Graphics for VEs. Ruth Aylett

Graphics for VEs. Ruth Aylett Graphics for VEs Ruth Aylett Overview VE Software Graphics for VEs The graphics pipeline Projections Lighting Shading VR software Two main types of software used: off-line authoring or modelling packages

More information

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

Computer Graphics (CS 4731) Lecture 18: Lighting, Shading and Materials (Part 3) Computer Graphics (CS 4731) Lecture 18: Lighting, Shading and Materials (Part 3) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: Flat Shading compute lighting once

More information

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

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch 15-462 Computer Graphics I Lecture 7 Lighting and Shading February 12, 2002 Frank Pfenning Carnegie Mellon University http://www.cs.cmu.edu/~fp/courses/graphics/ Light Sources Phong Illumination Model

More information

Surface Rendering Methods

Surface Rendering Methods Surface Rendering Methods 6 th Week, 2008 Sun-Jeong Kim Polygon Rendering Methods Determining the surface intensity at every projected pixel position using an illumination model Light-material interactions

More information

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

Shading Intro. Shading & Lighting. Light and Matter. Light and Matter Shading Intro Shading & Lighting Move from flat to 3-D models Orthographic view of sphere was uniformly color, thus, a flat circle A circular shape with many gradations or shades of color Courtesy of Vincent

More information

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

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL Overview Shading Shading Light-material interactions Phong model Shading polygons Shading in OpenGL Why we need shading Suppose we build a model of a sphere using many polygons and color it with glcolor.

More information

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

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11 Pipeline Operations CS 4620 Lecture 11 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives to pixels RASTERIZATION

More information

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

Shading. Why we need shading. Scattering. Shading. Objectives Shading Why we need shading Objectives Learn to shade objects so their images appear three-dimensional Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something

More information

CS 130 Exam I. Fall 2015

CS 130 Exam I. Fall 2015 CS 130 Exam I Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is

More information

Illumination & Shading: Part 1

Illumination & Shading: Part 1 Illumination & Shading: Part 1 Light Sources Empirical Illumination Shading Local vs Global Illumination Lecture 10 Comp 236 Spring 2005 Computer Graphics Jargon: Illumination Models Illumination - the

More information

Fast Phong Shading by Gary Bishop

Fast Phong Shading by Gary Bishop Fast Phong Shading by Gary Bishop Back Fast Phong Shading. p 103-105 Gary Bishop Room 4E-626 David M Weimer Room 4F-637 AT&T Bell Laboratories Crawfords Corner Road Holmdel, NJ 07733 Fast Phong Shading

More information

CSE 681 Illumination and Phong Shading

CSE 681 Illumination and Phong Shading CSE 681 Illumination and Phong Shading Physics tells us What is Light? We don t see objects, we see light reflected off of objects Light is a particle and a wave The frequency of light What is Color? Our

More information

Computer Graphics: 3-Local Illumination Models

Computer Graphics: 3-Local Illumination Models Computer Graphics: 3-Local Illumination Models Prof. Dr. Charles A. Wüthrich, Fakultät Medien, Medieninformatik Bauhaus-Universität Weimar caw AT medien.uni-weimar.de Introduction After having illustrated

More information

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline sequence of operations to generate an image using object-order processing primitives processed one-at-a-time

More information

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline sequence of operations to generate an image using object-order processing primitives processed one-at-a-time

More information

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY 1(84) Information Coding / Computer Graphics, ISY, LiTH TSBK 07 Computer Graphics Ingemar Ragnemalm, ISY 1(84) Lecture 5 3D graphics part 3 Illumination Illumination applied: Shading Surface detail: Mappings

More information

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016 Color and Light CSCI 4229/5229 Computer Graphics Fall 2016 Solar Spectrum Human Trichromatic Color Perception Color Blindness Present to some degree in 8% of males and about 0.5% of females due to mutation

More information

Computer Graphics. Illumination and Shading

Computer Graphics. Illumination and Shading () Illumination and Shading Dr. Ayman Eldeib Lighting So given a 3-D triangle and a 3-D viewpoint, we can set the right pixels But what color should those pixels be? If we re attempting to create a realistic

More information

Color and Light. CSCI 4229/5229 Computer Graphics Summer 2008

Color and Light. CSCI 4229/5229 Computer Graphics Summer 2008 Color and Light CSCI 4229/5229 Computer Graphics Summer 2008 Solar Spectrum Human Trichromatic Color Perception Are A and B the same? Color perception is relative Transmission,Absorption&Reflection Light

More information