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

Size: px
Start display at page:

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

Transcription

1 Lecture 9 Graphics pipeline (rasterization and shading)

2 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 is an important part of the graphics pipeline.

3 Graphics pipeline - part 2 (recap) Triangles that lie (partly) outside the view frustum need not be projected, and are clipped. The remaining triangles are projected if they are front facing. Projected triangles have to be shaded and/or textured.

4 Rasterizing triangles Introduction Scanline conversion Incremental updates Edge table and active edge table 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 that all pixels of the triangle get the same color.

5 Scanline conversion Incremental updates Edge table and active edge table Limiting the number of pixels to consider Instead of testing for all pixels in the image if they belong to the triangle, our book suggests to test only pixels in the bounding box of the triangle. The bounding box of a polygone can be specified by two points b 0 and b 1 with b0 = (min{x i }, min{y j }) b1 = (max{x i }, max{y j }) for all i, j = 1,, n (n = number of vertices)

6 Scanline conversion Incremental updates Edge table and active edge table Limiting the number of pixels to consider However, for long and skinny triangles that are diagnonally oriented, considering all pixels in their bounding box may still be quite inefficient.

7 Rasterizing general polygons Scanline conversion Incremental updates Edge table and active edge table Let s look at a more efficient way to draw triangles. The method actually works for general polygons; for triangles, it becomes even more efficient.

8 Scanline conversion Incremental updates Edge table and active edge table From pixel centers to pixel coordinates First, let s move our attention from pixels to the underlying coordinate system where the pixel centers have integer coordinates.

9 Scanline conversion Incremental updates Edge table and active edge table From pixel centers to pixel coordinates First, let s move our attention from pixels to the underlying coordinate system where the pixel centers have integer coordinates.

10 Scanline conversion Incremental updates Edge table and active edge table From pixel centers to pixel coordinates First, let s move our attention from pixels to the underlying coordinate system where the pixel centers have integer coordinates.

11 Scanline conversion Introduction Scanline conversion Incremental updates Edge table and active edge table Idea of the scanline algorithm: Instead of looking at each pixel individually, we draw our polygon one scanline at a time, from bottom to top, thus taking advantage of scanline coherence.

12 Scanline conversion Introduction Scanline conversion Incremental updates Edge table and active edge table Scanline 3 intersects two edges; these are called active edges. If we know the intersections of the active edges with the current scanline, then we know which pixels to set.

13 Computing intersections Introduction Scanline conversion Incremental updates Edge table and active edge table The left active edge runs from (1, 1) to (3, 8). The slope intercept equation, i.e. y = yj yi x j x i x + d with j > i for the line through these points is y = 3.5x 2.5 The x-coordinate of the intersection of this edge with scanline 3 is 1 4 7, so we know that we have to set pixels starting from x = 2.

14 Computing intersections Introduction Scanline conversion Incremental updates Edge table and active edge table The left active edge runs from (1, 1) to (3, 8). The slope intercept equation, i.e. y = yj yi x j x i x + d with j > i for the line through these points is y = 3.5x 2.5 The x-coordinate of the intersection of this edge with scanline 3 is 1 4 7, so we know that we have to set pixels starting from x = 2.

15 Scanline conversion Incremental updates Edge table and active edge table Computing intersections incrementally Computing intersections of scanlines and edges requires a division. These are expensive, and we d like to avoid them. We use the fact that the intersection of an edge with scanline i is related to the intersection with scanline i 1. This is called vertical coherence.

16 Scanline conversion Incremental updates Edge table and active edge table Computing intersections incrementally The slope of our left active edge is y j y i x j x i = y x = 7 2 (with j < i) Hence, the increase in x-coordinate from one scanline to the next is x = 2 7

17 Scanline conversion Incremental updates Edge table and active edge table Computing intersections incrementally Example: The x-coordinate at scanline 1 is obviously 1. Hence, we have: scanline x-coordinate (= )

18 Data structures: edge table (ET) Scanline conversion Incremental updates Edge table and active edge table In the Edge Table (ET), we maintain for every scanline a list of edges that start at the scanline. Each edge record contains: The x-coordinate of the lowest vertex. The y-coordinate of the highest vertex The value of x for the edge.

19 Scanline conversion Incremental updates Edge table and active edge table Data structures: active edge table (AET) When we proceed from one scanline to the next, we also maintain an Active Edge Table (AET). This table contains the edge record from the ET that are intersected by the current scanline. Whenever we move to the next scanline, we add the x -values of the active edges to the x-value.

20 Scanline conversion Incremental updates Edge table and active edge table Data structures: active edge table (AET) AET: scanline: edge records:

21 Active edge table Introduction Scanline conversion Incremental updates Edge table and active edge table An edge record is removed from the AET when the current scanline reaches the top of the edge. Recall that the 2nd entry of the edge record stores the y-coordinate of the top vertex.

22 Scanline conversion Introduction Scanline conversion Incremental updates Edge table and active edge table Summary of the whole algorithm: AET = for i = 0 to n 1 do update(aet,i) append(aet,et[i]) sort(aet) JoinLines(AET,i) for each scanline delete edge records for which y == i add x to x-values add edges starting here sort by x-value set pixels between pairs of edges

23 Active edge table Introduction Scanline conversion Incremental updates Edge table and active edge table AET: 1: (1, 8, 2 ), (1, 2, 8) 7 2: (1 2, 8, 2 1 ), (9, 2, 8), (9, 6, ) : (1 4, 8, 2 ), (8 1 1, 6, ) : (1 6, 8, 2 1 ), (4, 8, ), (4, 6, ), (8, 6, ) : (2 1, 8, 2 ), (3 3 1, 8, ), (5 1, 6, 1 1 ), (7 1 1, 6, : (2 3, 8, 2 ), ( : (2 5, 8, 2 ), (3 1 1, 8, : (3, 8, 2 1 ), (3, 8, ) 7 4, 8, 1 4 ), (7, 6, ) ), (7, 6, 1 2 ) 2 ) ET: 1: (1, 8, 2/7), (1, 2, 8) 2:(9, 6, 1/2) 4:(4, 8, 1/4), (4, 6, 1.5)

24 Interpolating z-values with scanline conversion Recall that hidden surface elimination can be done efficiently with z-buffer algorithm. But how do we get the z-values for each pixel?

25 Interpolating z-values with scanline conversion Again, we can compute these efficiently with bilinear interpolation, maintaining a z value for every edge, and computing values for the z-increment along every scanline. Instead of y 1 y 0 x 1 x 0 = y x = m x we use the slope y 1 y 0 z 1 z 0 = y z = m z and for y = 1, we get z = 1/m z.

26 Further comments on Interpolating z-values Disadvantages: Large memory requirements Individual pixels might get painted several times (can be critical if computing the color of a pixel is expensive) Do not support transparency

27 Bilinear interpolation to color triangles With this we can linearly interpolate color 1 between two vertices 2 between two edges Q: How to do this efficiently? What about phong shading? We will learn this in a later lecture

28 Bilinear interpolation to color triangles With this we can linearly interpolate color 1 between two vertices 2 between two edges Q: How to do this efficiently? What about phong shading? We will learn this in a later lecture

29 For every scanline, color-values at the edges of the triangle are computed by linearly interpolating the color values at the vertices. This can be done incrementaly, by precomputing r, g, and b values, and adding these to the r, g and b values of the previous scanline.

30 Colors along each scanline are also determined by linear interpolation. Again, this is done incrementally, by precomputing values. For each triangle, we do four devisions for each of its edges, to compute the x, r, g, and b values, and three divisions for every scanline it spans, to compute the color increments in horizontal direction.

31 Gouraud shading produces diffuse lighting that we usually see on matte surfaces. We had diffuse reflection before, remember? We called it Lambertian shading. Notice that there are different notations used in the book chapters 4.5 and 10. Here we use the latter.

32 Lambertian shading Introduction The direction of the incident light influences the intensity of the reflected light. Lambert s cosine law: c cos θ l or c n l with c being the color at this particular point Remember: a b = cos θ a b

33 Lambertian shading Introduction Notice that we have to do this calculations in world coordinates (because of the normals). Remember that the light source is only described by the vector l, i.e. by its direction and not its location. We call such light sources directional light (in contrast to, e.g., a spotlight that is defined by direction and location).

34 Lambertian shading Lambertian shading: Introduction with c = c r c l max(0, n l) c = the perceived color value c r = diffuse reflectance (fraction of light reflected by surface) c l = RGB intensity term (intensity of light source) Note: this is the notation from chapter 10 in the book, otherwise it s the same as in lecture 3 / chapter 4)

35 Lambertian shading Introduction Lambertian shading: c = c r c l max(0, n l) Characteristics: Proportional to cos θ l, hence max. for l = n can get negative

36 But how do we compute diffuse lighting at the vertices of the triangles/surfaces? It depends. We may specify that normals are indeed perpendicular to the surfaces. We may also make surfaces have their vertices shared, and somehow interpolate vertex normals.

37 But how do we compute diffuse lighting at the vertices of the triangles/surfaces? It depends. We may specify that normals are indeed perpendicular to the surfaces. We may also make surfaces have their vertices shared, and somehow interpolate vertex normals.

38 Considering ambient light Problem: points with normals facing away from the light will be black. We need some global illumination. Some heuristics to do this: Put dim light source at eye position or Add a constant color term to the color of each object (simulating a global light ) We already know that the latter is called ambient shading: c = c r (c a + c l max(0, n l))

39 Glossy reflection Introduction Diffuse reflection vs. specular reflection (source: shading)

40 Glossy reflection Introduction For glossy reflection, the viewing direction matters. Reflection is maximized when the angle of the reflected light equals the angle of the incident light, i.e., when e = r with r being the reflection vector. The scalar product (= cosine) offers a good heuristic that gradually decreases brightness when moving away from this maximum: c = c l ( e r)

41 Glossy reflection: Phong shading Using the Phone exponent p: c = c l max(0, e r) p we can influence size of our reflectance spot. To deal with negative values of the scalar product, we use max(0, e r) (cf. textbook, fig. 10.6, page 237 (9.6, p. 195 in 2nd ed.))

42 Glossy reflection: Phong shading Using the Phone exponent p: c = c l max(0, e r) p we can influence size of our reflectance spot. To deal with negative values of the scalar product, we use max(0, e r)

43 Glossy reflection: Phong shading Using the Phone exponent p: c = c l max(0, e r) p we can influence size of our reflectance spot. To deal with negative values of the scalar product, we use max(0, e r)

44 Glossy reflection Introduction In the Blinn-Phong model, we use the vector h that lies halfway between e and l: with c = c l ( n h) p h = e + l / e + l (note: e, l must be unit vectors) c l = RGB intensity term (intensity of light source) p = Phong exponent Note: again we are using the notation of chapter 10 here

45 Glossy reflection Introduction In the Blinn-Phong model, we use the vector h that lies halfway between e and l: with c = c l ( n h) p h = e + l / e + l (note: e, l must be unit vectors) c l = RGB intensity term (intensity of light source) p = Phong exponent Note: again we are using the notation of chapter 10 here

46 Phong normal interpolation Interpolating color values doesn t combine well with the Phong model: highlights in the interior of triangles are completely lost. However, we can interpolate normals instead, and do the computations of the Phong model using the interpolated normals. We can use barycentric coordinates for that: n = α n 0 + β n 1 + γ n 2

47 Phong normal interpolation Notice that we use a slightly different notation of barycentric coordinates here than before, i.e.: n(α, β, γ) = α n 0 + β n 1 + γ n 2 whereas in relation to triangles, we used: n(β, γ) = n 0 + β( n 1 n 0 ) + γ( n 2 n 0 ) which is the same if we set: α = 1 β γ

48 Phong normal interpolation Barycentric coordinates: p(β, γ) = a + β( b a) + γ( c a) We can rewrite this as p(β, γ) = a + β b β a + γ c γ a = (1 β γ) a + β b + γ c Which is the same as p(α, β, γ) = α a + β b + γ c if α = (1 β γ). The conditions for point-triangle intersection for this notation is 0 < α, β, γ < 1

49 Phong normal interpolation Barycentric coordinates: p(β, γ) = a + β( b a) + γ( c a) We can rewrite this as p(β, γ) = a + β b β a + γ c γ a = (1 β γ) a + β b + γ c Which is the same as p(α, β, γ) = α a + β b + γ c if α = (1 β γ). The conditions for point-triangle intersection for this notation is 0 < α, β, γ < 1

50 Bringing it all together... Combining ambient, Lambertian, and Blinn-Phong shading we get c = c r (c a + c l max(0, n l)) + c l ( h n) p Variations exist, e.g. we can add a control term c p that allows us to dim the highlight of the Phong shading: c = c r (c a + c l max(0, n l)) + c l c p ( h n) p Or we can add multiple light sources (cf. lecture 3).

51 Course overview Introduction Various other approaches exist for light calculations (e.g., Cook-Torrance BRDF, spotlights,... ). First part of the course: Introduction Vectors and curves Curves, surfaces, and shading Matrices and determinants Linear and affine transformations Texture mapping Second part: Pipeline 1: Perspective projection Pipeline 2: Clipping, culling, and z-buffer Pipeline 3: and shading Radiosity and shadows Ray tracing (basics) Ray tracing (advanced)

52 Conclusion Introduction Notice that we already covered almost all of the basic stuff i.e. chapters 1-11 of the book: We will not cover chapter 9, signal processing (2nd edition: chapter 4) We will not look into chapter 3: raster images (2nd edition: chapter 3, raster algorithms) We will however look into Chapter 4, ray tracing and 13, more ray tracing (2nd edition: chapter 10, ray tracing) And next time, we ll cover two topics not in the textbook, i.e. Radiosity (global illuminations) Shadows

53 Tutorials Introduction Please start filling up from room BBL-201. If we can have 2 tutors in 1 room, we can answer your questions faster and help you better.

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

Outline. Scanline conversion Incremental updates Edge table and active edge table. Gouraud shading Phong interpolation

Outline. Scanline conversion Incremental updates Edge table and active edge table. Gouraud shading Phong interpolation Outline Triangle rasterization 1 Triangle rasterization 2 Gouraud shading Phong interpolation 3 Interpolating z-values Further comments Rasterizing triangles We know how to project the vertices of a triangle

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

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

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

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

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

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 Matthias Zwicker Universität Bern Herbst 2009 Today Introduction Local shading models Light sources strategies Compute interaction of light with surfaces Requires simulation of physics Global

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 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

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

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

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

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

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

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

CSE 167: Lecture #7: Color and Shading. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 CSE 167: Introduction to Computer Graphics Lecture #7: Color and Shading Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 Announcements Homework project #3 due this Friday,

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

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

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Why do we need Lighting

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

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

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 CSE 167: Introduction to Computer Graphics Lecture #6: Lights Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 Announcements Thursday in class: midterm #1 Closed book Material

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

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

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside CS130 : Computer Graphics Lecture 8: Lighting and Shading Tamar Shinar Computer Science & Engineering UC Riverside Why we need shading Suppose we build a model of a sphere using many polygons and color

More information

Computer Graphics and GPGPU Programming

Computer Graphics and GPGPU Programming Computer Graphics and GPGPU Programming Donato D Ambrosio Department of Mathematics and Computer Science and Center of Excellence for High Performace Computing Cubo 22B, University of Calabria, Rende 87036,

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

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

Pipeline Operations. CS 4620 Lecture 14

Pipeline Operations. CS 4620 Lecture 14 Pipeline Operations CS 4620 Lecture 14 2014 Steve Marschner 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives

More information

CS 5625 Lec 2: Shading Models

CS 5625 Lec 2: Shading Models CS 5625 Lec 2: Shading Models Kavita Bala Spring 2013 Shading Models Chapter 7 Next few weeks Textures Graphics Pipeline Light Emission To compute images What are the light sources? Light Propagation Fog/Clear?

More information

Shading 1: basics Christian Miller CS Fall 2011

Shading 1: basics Christian Miller CS Fall 2011 Shading 1: basics Christian Miller CS 354 - Fall 2011 Picking colors Shading is finding the right color for a pixel This color depends on several factors: The material of the surface itself The color and

More information

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

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1) Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Why do we need Lighting & shading? Sphere

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

Illumination and Shading

Illumination and Shading 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

More information

CS4620/5620: Lecture 14 Pipeline

CS4620/5620: Lecture 14 Pipeline CS4620/5620: Lecture 14 Pipeline 1 Rasterizing triangles Summary 1! evaluation of linear functions on pixel grid 2! functions defined by parameter values at vertices 3! using extra parameters to determine

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

Deferred Rendering Due: Wednesday November 15 at 10pm

Deferred Rendering Due: Wednesday November 15 at 10pm CMSC 23700 Autumn 2017 Introduction to Computer Graphics Project 4 November 2, 2017 Deferred Rendering Due: Wednesday November 15 at 10pm 1 Summary This assignment uses the same application architecture

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

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

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

Institutionen för systemteknik

Institutionen för systemteknik Code: Day: Lokal: M7002E 19 March E1026 Institutionen för systemteknik Examination in: M7002E, Computer Graphics and Virtual Environments Number of sections: 7 Max. score: 100 (normally 60 is required

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

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane Rendering Pipeline Rendering Converting a 3D scene to a 2D image Rendering Light Camera 3D Model View Plane Rendering Converting a 3D scene to a 2D image Basic rendering tasks: Modeling: creating the world

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

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

Complex Shading Algorithms

Complex Shading Algorithms Complex Shading Algorithms CPSC 414 Overview So far Rendering Pipeline including recent developments Today Shading algorithms based on the Rendering Pipeline Arbitrary reflection models (BRDFs) Bump mapping

More information

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

CS230 : Computer Graphics Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside CS230 : Computer Graphics Lighting and Shading Tamar Shinar Computer Science & Engineering UC Riverside General light source Illumination function: [Angel and Shreiner] integrate contributions from all

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

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

CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014

CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014 CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014 TA: Josh Bradley 1 Linear Algebra Review 1.1 Vector Multiplication Suppose we have a vector a = [ x a y a ] T z a. Then for some

More information

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing Lecture 11 Ray tracing Introduction Projection vs. ray tracing Projection Ray tracing Rendering Projection vs. ray tracing Projection Ray tracing Basic methods for image generation Major areas of computer

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

Shading. Brian Curless CSE 557 Autumn 2017

Shading. Brian Curless CSE 557 Autumn 2017 Shading Brian Curless CSE 557 Autumn 2017 1 Reading Optional: Angel and Shreiner: chapter 5. Marschner and Shirley: chapter 10, chapter 17. Further reading: OpenGL red book, chapter 5. 2 Basic 3D graphics

More information

Raytracing CS148 AS3. Due :59pm PDT

Raytracing CS148 AS3. Due :59pm PDT Raytracing CS148 AS3 Due 2010-07-25 11:59pm PDT We start our exploration of Rendering - the process of converting a high-level object-based description of scene into an image. We will do this by building

More information

Simple Lighting/Illumination Models

Simple Lighting/Illumination Models Simple Lighting/Illumination Models Scene rendered using direct lighting only Photograph Scene rendered using a physically-based global illumination model with manual tuning of colors (Frederic Drago and

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

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

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller Local Illumination CMPT 361 Introduction to Computer Graphics Torsten Möller Graphics Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Interaction Color Texture/ Realism

More information

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1) Computer Graphics Lecture 14 Bump-mapping, Global Illumination (1) Today - Bump mapping - Displacement mapping - Global Illumination Radiosity Bump Mapping - A method to increase the realism of 3D objects

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

CHAPTER 1 Graphics Systems and Models 3

CHAPTER 1 Graphics Systems and Models 3 ?????? 1 CHAPTER 1 Graphics Systems and Models 3 1.1 Applications of Computer Graphics 4 1.1.1 Display of Information............. 4 1.1.2 Design.................... 5 1.1.3 Simulation and Animation...........

More information

-=Bui Tuong Phong's Lighting=- University of Utah, but with shaders. Anton Gerdelan Trinity College Dublin

-=Bui Tuong Phong's Lighting=- University of Utah, but with shaders. Anton Gerdelan Trinity College Dublin -=Bui Tuong Phong's Lighting=- University of Utah, 1973 but with shaders Anton Gerdelan Trinity College Dublin Before we do anything - normals Q. What does a normal do? Q. How do we usually calculate them?

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

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

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

Shading. Brian Curless CSE 457 Spring 2017

Shading. Brian Curless CSE 457 Spring 2017 Shading Brian Curless CSE 457 Spring 2017 1 Reading Optional: Angel and Shreiner: chapter 5. Marschner and Shirley: chapter 10, chapter 17. Further reading: OpenGL red book, chapter 5. 2 Basic 3D graphics

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

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

Interactive Real-Time Raycasting

Interactive Real-Time Raycasting Interactive Real-Time Raycasting CS184 AS4 Due 2009-02-26 11:00pm We start our exploration of Rendering - the process of converting a high-level object-based description into a graphical image for display.

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

Lighting/Shading III. Week 7, Wed Mar 3

Lighting/Shading III. Week 7, Wed Mar 3 University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Lighting/Shading III Week 7, Wed Mar 3 http://www.ugrad.cs.ubc.ca/~cs314/vjan2010 reminders News don't need to tell

More information

CS452/552; EE465/505. Intro to Lighting

CS452/552; EE465/505. Intro to Lighting CS452/552; EE465/505 Intro to Lighting 2-10 15 Outline! Projection Normalization! Introduction to Lighting (and Shading) Read: Angel Chapter 5., sections 5.4-5.7 Parallel Projections Chapter 6, sections

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

Computer Graphics. Shadows

Computer Graphics. Shadows Computer Graphics Lecture 10 Shadows Taku Komura Today Shadows Overview Projective shadows Shadow texture Shadow volume Shadow map Soft shadows Why Shadows? Shadows tell us about the relative locations

More information

CEng 477 Introduction to Computer Graphics Fall 2007

CEng 477 Introduction to Computer Graphics Fall 2007 Visible Surface Detection CEng 477 Introduction to Computer Graphics Fall 2007 Visible Surface Detection Visible surface detection or hidden surface removal. Realistic scenes: closer objects occludes the

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

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

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

Spring 2012 Final. CS184 - Foundations of Computer Graphics. University of California at Berkeley

Spring 2012 Final. CS184 - Foundations of Computer Graphics. University of California at Berkeley Spring 2012 Final CS184 - Foundations of Computer Graphics University of California at Berkeley Write your name HERE: Write your login HERE: Closed book. You may not use any notes or printed/electronic

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 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

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

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

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

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

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

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1 UNIVERSITY OF EAST ANGLIA School of Computing Sciences Main Series PG Examination 2013-14 COMPUTER GAMES DEVELOPMENT CMPSME27 Time allowed: 2 hours Answer any THREE questions. (40 marks each) Notes are

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline Last Time? The Traditional Graphics Pipeline Participating Media Measuring BRDFs 3D Digitizing & Scattering BSSRDFs Monte Carlo Simulation Dipole Approximation Today Ray Casting / Tracing Advantages? Ray

More information

The Rasterization Pipeline

The Rasterization Pipeline Lecture 5: The Rasterization Pipeline Computer Graphics and Imaging UC Berkeley CS184/284A, Spring 2016 What We ve Covered So Far z x y z x y (0, 0) (w, h) Position objects and the camera in the world

More information

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon Lighting and Shading Slides: Tamar Shinar, Victor Zordon Why we need shading Suppose we build a model of a sphere using many polygons and color each the same color. We get something like But we want 2

More information

Shading. Reading. Pinhole camera. Basic 3D graphics. Brian Curless CSE 557 Fall Required: Shirley, Chapter 10

Shading. Reading. Pinhole camera. Basic 3D graphics. Brian Curless CSE 557 Fall Required: Shirley, Chapter 10 Reading Required: Shirley, Chapter 10 Shading Brian Curless CSE 557 Fall 2014 1 2 Basic 3D graphics With affine matrices, we can now transform virtual 3D objects in their local coordinate systems into

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

CS 498 VR. Lecture 19-4/9/18. go.illinois.edu/vrlect19

CS 498 VR. Lecture 19-4/9/18. go.illinois.edu/vrlect19 CS 498 VR Lecture 19-4/9/18 go.illinois.edu/vrlect19 Review from previous lectures Image-order Rendering and Object-order Rendering Image-order Rendering: - Process: Ray Generation, Ray Intersection, Assign

More information

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura Computer Graphics Lecture 13 Global Illumination 1: Ray Tracing and Radiosity Taku Komura 1 Rendering techniques Can be classified as Local Illumination techniques Global Illumination techniques Local

More information

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

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops. OpenGl Pipeline Individual Vertices Transformed Vertices Commands Processor Per-vertex ops Primitive assembly triangles, lines, points, images Primitives Fragments Rasterization Texturing Per-fragment

More information

Local Illumination physics. Law of reflection and Snell s law of refraction

Local Illumination physics. Law of reflection and Snell s law of refraction Local Illumination physics Law of reflection and Snell s law of refraction What are we trying to model? Surface Proof of Lambert s cosine law n db da Computing R All vectors unit length!! The effect

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline Final Projects Proposals due Thursday 4/8 Proposed project summary At least 3 related papers (read & summarized) Description of series of test cases Timeline & initial task assignment The Traditional Graphics

More information

Rendering and Radiosity. Introduction to Design Media Lecture 4 John Lee

Rendering and Radiosity. Introduction to Design Media Lecture 4 John Lee Rendering and Radiosity Introduction to Design Media Lecture 4 John Lee Overview Rendering is the process that creates an image from a model How is it done? How has it been developed? What are the issues

More information

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker CMSC427 Shading Intro Credit: slides from Dr. Zwicker 2 Today Shading Introduction Radiometry & BRDFs Local shading models Light sources Shading strategies Shading Compute interaction of light with surfaces

More information

Graphics 2009/2010, period 1. Lecture 8: ray tracing

Graphics 2009/2010, period 1. Lecture 8: ray tracing Graphics 2009/2010, period 1 Lecture 8 Ray tracing Original plan Finish the basic stuff (book ch 1-9) today: We will not look into signal processing (chapter 4) We will look at triangle rasterization (cf.

More information

CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Homework project #2 due this Friday, October

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

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz Computing Visibility BSP Trees Ray Casting Depth Buffering Quiz Power of Plane Equations We ve gotten a lot of mileage out of one simple equation. Basis for D outcode-clipping Basis for plane-at-a-time

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