David Luebke1/10/2016 CS 551 / 645: Introductory Computer Graphics David Luebke

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

1 Computer Graphics Chapter 8 3D Transformations.
Geometric Transformations
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
MAE152 Computer Graphicsfor Scientists and Engineers Revision of Matrices Relevance to Graphics.
2/7/2001Hofstra University – CSC290B1 Review: Math (Ch 4)
Welcome to CSc 830 Advanced Computer Graphics
IAT 3551 Computer Graphics Overview Color Displays Drawing Pipeline.
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
HCT.
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Basic graphics. ReviewReview Viewing Process, Window and viewport, World, normalized and device coordinates Input and output primitives and their attributes.
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
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.
C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 1/29 Geometric Transformations Readings: Chapters 5-6.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Computer Graphics in Java1 Objects and Viewers Two basic entities (one object seen from two different positions) :
CSE 381 – Advanced Game Programming Basic 3D Graphics
Transformations Dr. Amy Zhang.
CS 445 / 645 Introduction to Computer Graphics Lecture 3 Mathematical Primitives Introduction to Transformations Lecture 3 Mathematical Primitives Introduction.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Week 2 - Wednesday CS361.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
Clipping Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by David Luebke)
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
David Luebke10/21/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
Geometric Objects and Transformation
The Rendering Pipeline CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
David Luebke11/14/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
1 Chapter 2: Geometric Camera Models Objective: Formulate the geometrical relationships between image and scene measurements Scene: a 3-D function, g(x,y,z)
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Jinxiang Chai CSCE 441 Computer Graphics 3-D Viewing 0.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing
Transformations CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
CS 445: Introduction to Computer Graphics David Luebke University of Virginia The Rendering Pipeline.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
3-D Geometric Transformations
Transformations: Projection CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
David Luebke2/16/2016 CS 551 / 645: Introductory Computer Graphics Mathematical Foundations The Rendering Pipeline.
Rendering Pipeline and Graphics Hardware Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
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.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
4. Geometric Objects and Transformations
Modeling Transformation
Outline 3D Viewing Required readings: HB 10-1 to 10-10
Computer Graphics Overview
Rendering Pipeline Fall, 2015.
CSCE 441 Computer Graphics 3-D Viewing
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
CENG 477 Introduction to Computer Graphics
CS451Real-time 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.
CS 551 / 645: Introductory Computer Graphics
CSCE441: Computer Graphics 2D/3D Transformations
Presentation transcript:

David Luebke1/10/2016 CS 551 / 645: Introductory Computer Graphics David Luebke

David Luebke1/10/2016 Side Note l Shifts versus additions

David Luebke1/10/2016 Where We’ve Been l Till now we’ve talked about a 2-D world l We’ve covered: –Display technology –Color –Framebuffers –Drawing 2-D lines (and drawing them fast) –Drawing 2-D polygons (especially triangles) –Clipping polygons

David Luebke1/10/2016 Where We’re Going l 3-D graphics (finally!) l Next lectures: –The graphics pipeline: the big picture –Rigid-body transforms n Math –Homogeneous coordinates n Math –The viewing transform n Math –The projection transform n Math

David Luebke1/10/ D Graphics: A Whirlwind Tour Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

David Luebke1/10/2016 The Display You Know Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

David Luebke1/10/2016 The Framebuffer You Know Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

David Luebke1/10/2016 The Rendering Pipeline Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay l Why do we call it a pipeline?

David Luebke1/10/ D Rendering You Know Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

David Luebke1/10/2016 Edge Equations You Know V2V2 V1V1 V0V0 l Find edge equations

David Luebke1/10/2016 Edge Equations You Know V2V2 V1V1 V0V0 - + l Disable processors where plugging (X proc, Y proc ) into edge equation of {V 0,V 1 } evaluates to negative

David Luebke1/10/2016 Edge Equations You Know V2V2 V1V1 V0V0 l Find edge equations

David Luebke1/10/2016 Edge Equations You Know V2V2 V1V1 V0V0 + - l Disable processors where plugging (X proc, Y proc ) into edge equation of {V 2,V 0 } evaluates to negative

David Luebke1/10/2016 Edge Equations You Know V2V2 V1V1 V0V0 + - l Disable processors where plugging (X proc, Y proc ) into edge equation of {V 2,V 1 } evaluates to negative

David Luebke1/10/2016 Edge Equations You Know V2V2 V1V1 V0V0 l All enabled processors evaluate linear expressions for triangle color, depth, etc.

David Luebke1/10/2016 Edge Walking (You Know?) l Traditional method: –Find edge equations {V 0 V 1 } {V 0 V 2 } {V 2 V 1 } –Find and fill spans where scanlines cross the edge –Just a bilinear interpolation! V0V0 V2V2 V1V1

David Luebke1/10/2016 The Rendering Pipeline: 3-D Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

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

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

David Luebke1/10/2016 Rendering: Transformations l So far, discussion has been in screen space l But model is stored in model space (a.k.a. object space or world space) l Three sets of geometric transformations: –Modeling transforms –Viewing transforms –Projection transforms

David Luebke1/10/2016 Rendering: Transformations l Modeling transforms –Size, place, scale, and rotate objects parts of the model w.r.t. each other –Object coordinates  world coordinates Z X Y X Z Y

David Luebke1/10/2016 Rendering: Transformations l Viewing transform –Rotate & translate the world to lie directly in front of the camera n Typically place camera at origin n Typically looking down -Z axis –World coordinates  view coordinates

David Luebke1/10/2016 Rendering: Transformations l Projection transform –Apply perspective foreshortening n Distant = small: the pinhole camera model –View coordinates  screen coordinates

David Luebke1/10/2016 Rendering: Transformations l All these transformations involve shifting coordinate systems (i.e., basis sets) l That’s what matrices do… l Represent coordinates as vectors, transforms as matrices l Multiply matrices = concatenate transforms!                     Y X Y X   cossin cos

David Luebke1/10/2016 Rendering: Transformations l Homogeneous coordinates: represent coordinates in 3 dimensions with a 4-vector –Denoted [x, y, z, w] n Note that typically w = 1 in model coordinates –To get 3-D coordinates, divide by w: [x’, y’, z’] = [x/w, y/w, z/w] l Transformations are 4x4 matrices l Why? To handle translation and projection

David Luebke1/10/2016 Rendering: Transformations l OpenGL caveats: –All modeling transforms and the viewing transform are concatenated into the modelview matrix –A stack of modelview matrices is kept –The projection transform is stored separately in the projection matrix l See Chapter 3 of the OpenGL book

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

David Luebke1/10/2016 Rendering: Lighting l Illuminating a scene: coloring pixels according to some approximation of lighting –Global illumination: solves for lighting of the whole scene at once –Local illumination: local approximation, typically lighting each polygon separately l Interactive graphics (e.g., hardware) does only local illumination at run time

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

David Luebke1/10/2016 Rendering: Clipping l Clipping a 3-D primitive returns its intersection with the view frustum: l See Foley & van Dam section 19.1

David Luebke1/10/2016 Rendering: Clipping l Clipping is tricky! In: 3 vertices Out: 6 vertices Clip In: 1 polygon Out: 2 polygons

David Luebke1/10/2016 The Rendering Pipeline: 3-D Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

David Luebke1/10/2016 Modeling: The Basics l Common interactive 3-D primitives: points, lines, polygons (i.e., triangles) l Organized into objects –Collection of primitives, other objects –Associated matrix for transformations l Instancing: using same geometry for multiple objects –4 wheels on a car, 2 arms on a robot

David Luebke1/10/2016 Modeling: The Scene Graph l The scene graph captures transformations and object-object relationships in a DAG l Objects in black; blue arrows indicate instancing and each have a matrix Robot BodyHead ArmTrunkLegEyeMouth

David Luebke1/10/2016 Modeling: The Scene Graph l Traverse the scene graph in depth-first order, concatenating transformations l Maintain a matrix stack of transformations ArmTrunk Leg EyeMouth HeadBody Robot Foot Matrix Stack Visited Unvisited Active

David Luebke1/10/2016 Modeling: The Camera l Finally: need a model of the virtual camera –Can be very sophisticated n Field of view, depth of field, distortion, chromatic aberration… –Interactive graphics (OpenGL): n Pinhole camera model u Field of view u Aspect ratio u Near & far clipping planes n Camera pose: position & orientation

David Luebke1/10/2016 Modeling: The Camera l These parameters are encapsulated in a projection matrix –Homogeneous coordinates  4x4 matrix! –See OpenGL Appendix F for the matrix l The projection matrix premultiplies the viewing matrix, which premultiplies the modeling matrices –Actually, OpenGL lumps viewing and modeling transforms into modelview matrix

David Luebke1/10/2016 Rigid-Body Transforms l Goal: object coordinates  world coordinates l Idea: use only transformations that preserve the shape of the object –Rigid-body or Euclidean transforms –Includes rotation, translation, and scale l To reiterate: we will represent points as column vectors:

David Luebke1/10/2016 Vectors and Matrices l Vector algebra operations can be expressed in this matrix form –Dot product: –Cross product: n Note: use right-hand rule!

David Luebke1/10/2016 Translations l For convenience we usually describe objects in relation to their own coordinate system –Solar system example l We can translate or move points to a new position by adding offsets to their coordinates: –Note that this translates all points uniformly

David Luebke1/10/ D Rotations l Rotations in 2-D are easy: l 3-D is more complicated –Need to specify an axis of rotation –Common pedagogy: express rotation about this axis as the composition of canonical rotations n Canonical rotations: rotation about X-axis, Y-axis, Z-axis

David Luebke1/10/ D Rotations l Basic idea: –Using rotations about X, Y, Z axes, rotate model until desired axis of rotation coincides with Z-axis –Perform rotation in the X-Y plane (i.e., about Z-axis) –Reverse the initial rotations to get back into the initial frame of reference l Objections: –Difficult & error prone –Ambiguous: several combinations about the canonical axis give the same result –For a different approach, see McMillan’s lecture 12