CS 551 / 645: Introductory Computer Graphics

Slides:



Advertisements
Similar presentations
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Advertisements

Graphics Pipeline.
2 COEN Computer Graphics I Evening’s Goals n Discuss the fundamentals of lighting in computer graphics n Analyze OpenGL’s lighting model n Show.
Computer Graphics Lecture 8 Arbitrary Viewing II: More Projection, Clipping and Mathematics of 3D Viewing.
3D Graphics Rendering and Terrain Modeling
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Implementation Dr. Amy Zhang. Reading 2  Hill, Chapters  Hill, Chapter 10.
Sep 21, Fall 2005ITCS4010/ Computer Graphics Overview Color Displays Drawing Pipeline.
(conventional Cartesian reference system)
Sep 21, Fall 2006IAT 4101 Computer Graphics Overview Color Displays Drawing Pipeline.
IAT 3551 Computer Graphics Overview Color Displays Drawing Pipeline.
Basics of Rendering Pipeline Based Rendering –Objects in the scene are rendered in a sequence of steps that form the Rendering Pipeline. Ray-Tracing –A.
COMP 175: Computer Graphics March 24, 2015
CS 551 / 645: Introductory Computer Graphics
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Rasterization Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by David Luebke)
Triangle Scan Conversion. 2 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Rasterization Rasterization (scan conversion) –Determine which.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
Clipping Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by David Luebke)
David Luebke10/21/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
CS 445 / 645: Introductory Computer Graphics Light.
The Rendering Pipeline CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
CAP4730: Computational Structures in Computer Graphics
David Luebke11/14/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Drawing Triangles CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
David Luebke12/7/2015 CS 551 / 645: Introductory Computer Graphics Review for Midterm.
Introduction to Computer Graphics CS 445 / 645 Lecture 9 Chapter 4: Rasterization L. McMillan MIT notes (Fall ’98)
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
David Luebke1/10/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
Local Illumination and Shading
David Luebke2/23/2016 CS 551 / 645: Introductory Computer Graphics Color Continued Clipping in 3D.
2/28/2016 CS 551 / 645: Introductory Computer Graphics Framebuffer Mathematical Foundations The Rendering Pipeline.
Computer Graphics One of the central components of three-dimensional graphics has been a basic system that renders objects represented by a set of polygons.
David Luebke3/16/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Graphics Review Geometry, Color & Shading Brad Tennis Leslie Wu
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
3D Ojbects: Transformations and Modeling. Matrix Operations Matrices have dimensions: Vectors can be thought of as matrices: v=[2,3,4,1] is a 1x4 matrix.
Applications and Rendering pipeline
Chapter 71 Computer Graphics - Chapter 7 From Vertices to Fragments Objectives are: How your program are processed by the system that you are using, Learning.
Unit-4 Geometric Objects and Transformations- I
Computer Graphics Overview
Computer Graphics Clipping.
CS 551 / 645: Introductory Computer Graphics
Rendering Pipeline Fall, 2015.
- Introduction - Graphics Pipeline
Photorealistic Rendering vs. Interactive 3D Graphics
CS 551 / 645: Introductory Computer Graphics
Clipping Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006
Clipping Polygon Clipping Polygon : Area primitive
Deferred Lighting.
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Jim X. Chen George Mason University
Chapter 14 Shading Models.
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
WINDOWING AND CLIPPING
OpenGL 2D Viewing Pipeline
Computer Graphics One of the central components of three-dimensional graphics has been a basic system that renders objects represented by a set of polygons.
WINDOWING AND CLIPPING
Lecture 13 Clipping & Scan Conversion
Clipping Jian Huang, CS594 This set of slides reference slides devised at Ohio State and MIT.
© University of Wisconsin, CS559 Fall 2004
CS5500 Computer Graphics May 29, 2006
Chapter 14 Shading Models.
Clipping University of British Columbia CPSC 314 Computer Graphics
Presentation transcript:

CS 551 / 645: Introductory Computer Graphics Review for Midterm David Luebke 7/30/2018

Administrivia Hand out assignment 2 Hand in assignment 3 Late day policy: 1 late day = due tomorrow at noon Subsequent late days add 24 hours each Weekends and holidays count Compiling with C++ UNIX C++ compilers: g++ and /bin/CC I’ll make sure it works before next assignment David Luebke 7/30/2018

Midterm Examination Midterm is this Thursday (March 9) Study aids: This lecture Earlier lectures (available on course page) Last semester’s midterm See http://www.cs.virginia.edu/~luebke/old_cs551/ But, its not quite the same material No calculators! (you won’t need them) David Luebke 7/30/2018

Display Technologies Cathode Ray Tubes Earliest, still most common graphical display Understand the basic mechanism Vacuum tube, phosphors, electron beam Pros: bright, fairly high-res, leverages TV tech Cons: bulky, size-limited, finicky David Luebke 7/30/2018

Display Technologies Vector versus raster display Vector: traces lines like an oscilloscope Pros: bright, crisp, uniform lines Cons: wireframe only, flicker for complex scenes Raster: fixed scan pattern for electron beam, intensity controlled by scan-out from frame buffer Pros: display solid objects, image complexity limited only by framebuffer resolution Cons: discreet sampling (aliasing), memory cost David Luebke 7/30/2018

Display Technologies LCDs Understand the basic mechanism Polarized light, crystals twist 90º unless excited Basically a light valve: reflective or transmissive Pros: light-weight and thin Cons: expensive, high-power (when backlit), limited in size David Luebke 7/30/2018

Display Technologies Also know: Plasma display panels Digital Micromirror Devices David Luebke 7/30/2018

Framebuffers Memory array storing image in pixels Issues: memory speed, size, bus contention Different types in common use, motivated mainly by memory cost True-Color: 24 bits, 8 per RGB (or 32 bits with ) Hi-Color: 16 bits (R = 6, G = 6, B = 4) Pseudo-Color: 8 bits index into 256-entiry color lookup table (entries typically 24-bits) David Luebke 7/30/2018

Mathematical Foundations Geometry (2-D, 3-D) Trigonometry Vector spaces Elements: scalars and vectors Operations: Addition (identity & inverse) Scalar multiplication (distributive rule) Linear combinations, dimension, basis sets Inner (dot) product, vector (cross) product David Luebke 7/30/2018

Mathematical Foundations Affine spaces Elements: points Operations: Subtraction (point - point = vector) Addition (vector + point = point) Matrices Linear transforms, vector-matrix multiplication Matrix-matrix multiplication Composition of linear transforms = matrix concatenation David Luebke 7/30/2018

The Rendering Pipeline Transform Illuminate Clip Project Rasterize Model & Camera Parameters Rendering Pipeline Framebuffer Display David Luebke 7/30/2018

The Rendering Pipeline: 3-D Scene graph Object geometry Result: All vertices of scene in shared 3-D “world” coordinate system Vertices shaded according to lighting model Scene vertices in 3-D “view” or “camera” coordinate system Exactly those vertices & portions of polygons in view frustum 2-D screen coordinates of clipped vertices Modeling Transforms Lighting Calculations Viewing Transform Clipping Projection Transform David Luebke 7/30/2018

Geometric Transforms Modeling transforms: object coordinates  world coordinates Viewing transform: world coordinates  eye coordinates eye coordinates == camera coordinates == view coordinates Projection transform: eye coordinates  2-D screen coordinates David Luebke 7/30/2018

Geometric Transforms Understand homogeneous coordinates [x, y, z, w]T == (x/w, y/w, z/w) Allows us to capture translation and projection as matrices Know your 4x4 Euclidean transform matrices: Translation, scale, rotation about X, Y, Z Understand rotation about an arbitrary axis Understand order of composition for matrices In OpenGL: using column vectors as points  order from right to left David Luebke 7/30/2018

Perspective Projection Geometry of the perspective projection: P (x, y, z) X Z View plane d (0,0,0) x’ = ? David Luebke 7/30/2018

Perspective Projection Desired result: David Luebke 7/30/2018

Perspective Projection A matrix that accomplishes this: David Luebke 7/30/2018

Rasterizing Lines Review McMillan’s great java-enabled lecture First stab: slope-intercept + symmetry A case study in optimization Special case boundary conditions if necessary Optimize inner loops Incremental update using DDA (biggest win) Low-level tricks: integer arithmetic, compare to 0, etc. Culmination: Bresenham’s algorithm Be aware of diminishing returns and readability/portability tradeoffs David Luebke 7/30/2018

Rasterizing Triangles Triangles are nice to deal with because they are always planar and always convex Triangle rasterization techniques: REYES: recursive subdivision of primitive Warnock: recursive subdivision of screen Edge walking Edge equations David Luebke 7/30/2018

Rasterizing Triangles Edge walking: Draw edges vertically Fill in horizontal spans for each scanline Interpolate colors down edges At each scanline, interpolate edge colors across span Pros: Fast: touch only lit pixels, touch pixels only once Cons: Finicky: lots of special cases, hard to get just right David Luebke 7/30/2018

Rasterizing Triangles Edge Equations Equation of a line defines two half-spaces Triangle can be represented as intersection of three half-spaces: A1x + B1y + C1 < 0 A2x + B2y + C2 < 0 A3x + B3y + C3 < 0 A1x + B1y + C1 > 0 A3x + B3y + C3 > 0 A2x + B2y + C2 > 0 David Luebke 7/30/2018

Rasterizing Triangles Basic algorithm: Walk pixels in bounding box Evaluate three edge equations If all are greater than zero, shade pixel Issues: Computing edge equations: numerical precision Interpolating parameters (i.e., color): just like another edge equation (why?) Optimizing the algorithm Like line rasterization: DDA, early termination, etc. David Luebke 7/30/2018

Rasterizing General Polygons B C D E F G I H Parity test: Starting outside polygon, count edges crossed. Odd = inside, even = outside Big cost: testing every edge against every pixel Solution: the active edge table algorithm Sort edges by Y Keep a list of edges that intersect current scanline, sorted by their X-intersection w/ scanline David Luebke 7/30/2018

Clipping Lines Cohen-Sutherland Algorithm Clip 2-D line segments to rectangular viewport Designed for rapid trivial accept & trivial reject ops 4-bit outcodes divide screen into 9 regions Bitwise operations determine whether to accept, reject, or intersect with a viewport edge & recurse May require multiple iterations David Luebke 7/30/2018

Clipping Polygons Clipping polygons fundamentally more difficult Polygons can gain or lose edges Concave polygons can even multiply Sutherland-Hodgman Algorithm Simplify by divide-and-conquer: consider each clipping plane individually Input: polygon as ordered list of vertices Output: polygon as ordered list of vertices Lends itself to pipelined hardware implementation David Luebke 7/30/2018

Clipping Polygons Sutherland-Hodgman Algorithm Know the details: Point-plane test Line-plane intersection Rules: inside outside inside outside inside outside inside outside p p s s p s p s p output i output no output i output p output David Luebke 7/30/2018

Clipping in 3-D Problem: clipping under perspective must happen before homogeneous divide Solution 1: clip to hither plane in eye coordinates, then multiply by projection matrix, then do homogeneous divide Better: transform to canonical perspective coordinates to simplify clipping Solution 2: clip after projection (must clip all 4 homogeneous coordinates) Solution 3 (ugly but common): clip to hither & yon before projection, clip to 2-D viewport after projection and divide David Luebke 7/30/2018

Color Rods and cones Cones and color perception Gamma correction Metamers 3-D color: X, Y, and Z; CIE color space Gamma correction David Luebke 7/30/2018

Lighting Definitions: illumination, lighting, shading Illumination: Direct versus indirect Light properties: geometry, spectrum Common simplifications: ambient, directional, and point Surface material: geometry, reflectance, microstructure Common simplification: Phong lighting Diffuse (Lambertian) reflection: incoming light reflected equally in all directions, proportional to N • L Specular reflection: approximate falloff with (V • R)nshiny David Luebke 7/30/2018

Lighting Putting it all together: the Phong lighting model Note: evaluate per light, per color component Common simplification: constant V (viewer infinitely far away) David Luebke 7/30/2018

Shading Where to apply lighting calculations? Once per face: flat shading Once per vertex, interpolate resulting color: Gouraud shading Once per pixel, interpolating normal vectors from vertices: Phong shading Flat shading Phong Shading David Luebke 7/30/2018