Exam 3 Review Questions. Q1: Rasterize the line (2, -1) to (4, -6) (hint: Bresenham)

Slides:



Advertisements
Similar presentations
16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
Advertisements

Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Computer Graphics - Class 10
Raster conversion algorithms for line and circle
(conventional Cartesian reference system)
X86 and 3D graphics. Quick Intro to 3D Graphics Glossary: –Vertex – point in 3D space –Triangle – 3 connected vertices –Object – list of triangles that.
Status – Week 277 Victor Moya.
Coordinate Systems X Y Z (conventional Cartesian reference system) X Y Z.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
1/1/20001 Topic >>>> Scan Conversion CSE Computer Graphics.
Scan Conversion Line and Circle
Image Formation CS418 Computer Graphics John C. Hart.
Triangle Scan Conversion. 2 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Rasterization Rasterization (scan conversion) –Determine which.
1 Texture Mapping ©Anthony Steed Overview n Texture mapping Inverse and Forward Mapping Bilinear interpolation Perspective correction n Mipmapping.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
COMP 261 Lecture 16 3D Rendering. input: set of polygons viewing direction direction of light source(s) size of window. output: an image Actions rotate.
Shading & Texture. Shading Flat Shading The process of assigning colors to pixels. Smooth Shading Gouraud ShadingPhong Shading Shading.
1Computer Graphics Implementation III Lecture 17 John Shearer Culture Lab – space 2
Shading Examples shaderSphere1, 2, 3 & 4 of Chapter 6.
Illumination and Shading How to shade surfaces based on the position,orientation,characteristics of the surfaces and the light sources illuminating them.
Programming 3D Applications CE Displaying Computer Graphics Week 3 Lecture 5 Bob Hobbs Faculty of Computing, Engineering and Technology Staffordshire.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS418 Computer Graphics John C. Hart
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
High detail models, depth of field, soft shadows, reflective surfaces. (Image created by Toxic Studios using Brazil R/S)
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner Rasterization.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
Bump Map 1. High Field Function: H(u, v) New Normal : N’
CS 325 Introduction to Computer Graphics 02 / 03 / 2010 Instructor: Michael Eckmann.
CS COMPUTER GRAPHICS LABORATORY. LIST OF EXPERIMENTS 1.Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2.Implementation of Line,
Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
Illumination and Shading Prof. Lizhuang Ma Shanghai Jiao Tong University.
Schedule Update GP 4 – Tesselation/Cg GDS 4 – Subdiv Surf. GP 5 – Object Modeling Lab: Mini-proj Setup GDS 5 – Maya Modeling MCG 6 – Intersections GP 6.
Write Bresenham’s algorithm for generation of line also indicate which raster locations would be chosen by Bresenham’s algorithm when scan converting.
CS 418 : EXAM 2 REVIEW TA: Ryan Freedman Sushma Kini Chi Zhou.
Graphics Pipeline Bringing it all together. Implementation The goal of computer graphics is to take the data out of computer memory and put it up on the.
Illumination and Shading Prof. Lizhuang Ma Shanghai Jiao Tong University.
Scan Conversion of Line Segments. What is Scan conversion? Final step of rasterization (the process of taking geometric shapes and converting them into.
Shaders, part 2 alexandri zavodny.
ICG Syllabus 1. Introduction 2. Viewing in 3D and Graphics Programming
The Graphic PipeLine
Visual Appearance Chapter 4
A complete pipeline for 3D graphics
3D Graphics Rendering PPT By Ricardo Veguilla.
Texture Mapping COMP575/COMP770.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Chapter 14 Shading Models.
Introduction to Computer Graphics with WebGL
CSC461: Lecture 23 Shading Computation
Introduction to Computer Graphics with WebGL
Chapter IX Bump Mapping
Introduction to Meshes
CSC418 Computer Graphics Shading Color.
ICG 2018 Fall Homework1 Guidance
Chapter IX Lighting.
Illumination and Shading
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Game Programming Algorithms and Techniques
Chapter 14 Shading Models.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Simple Texture Mapping
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Introduction to Meshes
Bell work: Turn in when completed
Presentation transcript:

Exam 3 Review Questions

Q1: Rasterize the line (2, -1) to (4, -6) (hint: Bresenham)

Step 1: Put the line into octant “0” Add (-2, 1) to the endpoints: (0, 0) to (2, -5) Rotate (2, -5) into octant “0” X’=- x’=-y, y’=x x’= 5, y’=2 (5, 2)

Q1: Rasterize the line (2, -1) to (4, -6) (hint: Bresenham) Step 2: Apply Bresenham algorithm to each step Plot the endpoints. Then, y = mx+b m = (y1-y0)/(x1-x0) B = y0 – mx0 F(x,y) = mx + b – y If f(M) < 0,  E If f(M) >=0,  NE

Q1: Rasterize the line (2, -1) to (4, -6) (hint: Bresenham) Step 2: Apply Bresenham algorithm to each step Plot the endpoints. Then, Start with: P = (0,0) b = 0 m = 2/5 = 0.4 F(P) = mx + b – y = 0 M = P + (1, 0.5) = (1, 0.5) F(M) = mx – y = (0.4) -0.5 = -0.1 < -0 Therefore, select E (1, 0)

Q1: Rasterize the line (2, -1) to (4, -6) (hint: Bresenham) Step 2: Apply Bresenham algorithm to each step Plot the endpoints. Then: P = (1,0) b = 0 m = 2/5 = 0.4 F(P) = mx + b – y = 0 M = P + (1, 0.5) = (2, 0.5) F(M) = mx – y = (0.4)(2) – 0.5 = 0.8 – 0.5 = 0.3 Therefore, select NE (2, 1)

Q1: Rasterize the line (2, -1) to (4, -6) (hint: Bresenham) Step 2: Apply Bresenham algorithm to each step Plot the endpoints. Then: P = (2,1) b = 0 m = 2/5 = 0.4 F(P) = mx + b – y = 0 M = P + (1, 0.5) = (3, 1.5) F(M) = mx – y = (0.4)(3) – 1.5 = 1.2 – 1.5 = -0.3 Therefore, select E (3, 1)

Q1: Rasterize the line (2, -1) to (4, -6) (hint: Bresenham) Step 2: Apply Bresenham algorithm to each step Plot the endpoints. Then: P = (3,1) b = 0 m = 2/5 = 0.4 F(P) = mx + b – y = 0 M = P + (1, 0.5) = (4, 1.5) F(M) = mx – y = (0.4)(4) – 1.5 = 1.6 – 1.5 = 0.1 Therefore, select NE (4, 2)

Q1: Rasterize the line (2, -1) to (4, -6) (hint: Bresenham) Step 3: Rotate the points back into the unrotated quadrant Points are: (0,0), (1,0), (2,1), (3,1), (4, 2), (5,2) We want to put (x’,y’)=(5,2) back at (x,y)=(2, -5) where it came from. To do this, we see that x = y’ and y = -x’ (0,0)  (0,0) (1,0)  (0,-1) (2,1)  (1, -2) (3,1)  (1, -3) (4,2)  (2, -4) (5,2)  (2, -5)

Q1: Rasterize the line (2, -1) to (4, -6) (hint: Bresenham) Step 3: Rotate the points back into the unrotated quadrant Points are: (0,0), (1,0), (2,1), (3,1), (4, 2), (5,2) We want to put (x’,y’)=(5,2) back at (x,y)=(2, -5) where it came from. To do this, we see that x = y’ and y = -x’ (0,0)  (0,0) (1,0)  (0,-1) (2,1)  (1, -2) (3,1)  (1, -3) (4,2)  (2, -4) (5,2)  (2, -5)

Q1: Rasterize the line (2, -1) to (4, -6) (hint: Bresenham) Step 4: Translate the points back to their original location Rotated points are: (0,0), (0,-1), (1,-2), (1,-3), (2, -4), (2,-5) In step 1, we added (-2, 1) to translate the endpoint (2, -1) to the origin. Now move it back so that the endpoints are at their original points: (2, -1) and (4, -6) This means adding (2, -1) to all of the points.

Q1: Rasterize the line (2, -1) to (4, -6) (hint: Bresenham) Step 4: Translate the points back to their original location Rotated points are: (0,0), (0,-1), (1,-2), (1,-3), (2, -4), (2,-5) Add (2, -1) to everything: (2,-1), (2,-2), (3,-3), (3,-4), (4,-5), (4,-6)

Q1: Rasterize the line (2, -1) to (4, -6) (hint: Bresenham) Step 4: Translate the points back to their original location Rotated points are: (0,0), (0,-1), (1,-2), (1,-3), (2, -4), (2,-5) Add (2, -1) to everything:

Q2: Fill in pseudocode for the Bresenham algorithm (assume the line is in the initial octant) To plot something, say plot(x,y) plotLine(x0, y0, x1, y1) { … for (n=1 to x1) { … } … }

Q2: Fill in pseudocode for the Bresenham algorithm (assume the line is in the initial octant) To plot something, say plot(x,y) plotLine(x0, y0, x1, y1) { plot(x0,y0); dx=x1-x0; dy=y1-y0; slope=dy/dx; current_x = 0; current_y = 0; for (n=1 to x1) { Mx = current_x + 1; My = current_y + 0.5; f_of_M = slope*Mx - My; if (f_of_M < 0) // Plot E { current_x = current_x + 1; current_y = current_y; plot(current_x, current_y); } else // Plot NE { current_x = current_x + 1; My = current_y + 1; plot(current_x, current_y); } } plot(x1, y1); }

Q3A: Match the shading method to the technique for handling normals Shading methods: 1: Flat Shading 2: Goraud Shading 3: Phong Shading 4: Bump Mapping Normal Handling: A: Only the first normal of the triangle is used to calculate lighting in the entire triangle B: Normals are interpolated across the surface, and the light is computed at each fragment C: Normals are stored in a texture and used instead of Phong normals D: The light intensity is computed at each vertex and interpolated across the surface

Q3A: Match the shading method to the technique for handling normals Shading methods: 1: Flat Shading 2: Goraud Shading 3: Phong Shading 4: Bump Mapping Normal Handling: A: Only the first normal of the triangle is used to calculate lighting in the entire triangle B: Normals are interpolated across the surface, and the light is computed at each fragment C: Normals are stored in a texture and used instead of Phong normals D: The light intensity is computed at each vertex and interpolated across the surface 1-A, 2-D, 3-B, 4-C

Q3A: Which of these statements are true regarding cube maps in WebGL? 1.Objects can be concave 2.No reflections between objects are supported 3.The implementation assumes that the environment is close to the object 4.You can use the same map on an object if the viewer moves. 5.Cube maps support self-reflections on an object 6.You need a reflection map for each object

Q3A: Which of these statements are true regarding cube maps in WebGL? 1.Objects can be concave 2.No reflections between objects are supported 3.The implementation assumes that the environment is close to the object 4.You should use the same map on an object if the viewer moves. 5.Cube maps support self-reflections within an object 6.You need a reflection map for each object 1:F, 2:T, 3:F, 4:F, 5:F, 6:T

Q4: Texture Filtering Suppose we have following texture of greyscale values: T(4,5)=0.25, T(4,4)=0.47, T(5,5)=0.98, T(5,4)=0.45 Find the Texture value at (4.2,4.7) using Nearest Neighbor and Bilinear Interpolation.

Q4: Texture Filtering Suppose we have following texture of greyscale values: T(4,5)=0.25, T(4,4)=0.47, T(5,5)=0.98, T(5,4)=0.45 Find the Texture value at (4.2,4.7) using Nearest Neighbor and Bilinear Interpolation. Nearest Neighbor: (4.2, 4.7) is closer to (4,5), so T(4.2,4.7)=0.25

Bilinear Interpolation Let (u’,v’) = (0.2, 0.7) Interpolation in X: T top = (1-0.2)*T(4,5)+(1-0.8)*T(5,5) =0.396 T bottom =(1-0.2)*T(4,4)+(1-0.8)*T(5,4)= Interpolation in Y: =(1-0.3)* T top + (1-0.7)* T bottom =0.417 Texture value at (4.2, 4.7) is 0.417