© Wolfgang Heidrich University of British Columbia Geometric Transformations recap recap composition of transformations composition of transformations.

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

COMPUTER GRAPHICS SOFTWARE.
Computer Graphics Lecture 4 Geometry & Transformations.
Graphics Pipeline.
3D Graphics Rendering and Terrain Modeling
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Transformations III Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections I.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations Week 2,
Transformations II Week 2, Wed Jan 17
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Math Review Rendering.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
HCI 530 : Seminar (HCI) Damian Schofield.
2D Geometric Transformations
© Tamara Munzner University of British Columbia Hierarchical modelling recap: composing transforms recap: composing transforms finish: rendering pipeline.
1 Jinxiang Chai CSCE 441 Computer Graphics. 2 Midterm Time: 10:10pm-11:20pm, 10/20 Location: HRBB 113.
Graphics Systems I-Chen Lin’s CG slides, Doug James’s CG slides Angel, Interactive Computer Graphics, Chap 1 Introduction to Graphics Pipeline.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Transformations III Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Rendering Pipeline OpenGL/GLUT.
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by Greg Humphreys)
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Technical Background.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
10/5/04© University of Wisconsin, CS559 Fall 2004 Last Time Compositing Painterly Rendering Intro to 3D Graphics Homework 3 due Oct 12 in class.
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 Transformations Jehee Lee Seoul National University.
2003CS Hons RW778 Graphics1 Chapter 5: Transforming Objects 5.2 Introduction to Transformations 5.2 Introduction to Transformations –Affine transformations.
Computer Graphics. Requirements Prerequisites Prerequisites CS 255 : Data Structures CS 255 : Data Structures Math 253 Math 253 Experience with C Programming.
Transformations Jehee Lee Seoul National University.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
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.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
The Rendering Pipeline CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
CS559: Computer Graphics Lecture 8: 3D Transforms Li Zhang Spring 2008 Most Slides from Stephen Chenney.
CS559: Computer Graphics Lecture 8: Warping, Morphing, 3D Transformation Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Basic 3D Concepts. Overview 1.Coordinate systems 2.Transformations 3.Projection 4.Rasterization.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Scan Conversion Week 5, Fri 3 Oct 2003 recap: shading scan conversion: lines.
Subject Name: Computer Graphics Subject Code: Textbook: “Computer Graphics”, C Version By Hearn and Baker Credits: 6 1.
Geometric Transformations Sang Il Park Sejong University Many slides come from Jehee Lee’s.
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
Transformations: Projection CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Affine Geometry.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
Transformations of objects
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
Final Review I University of British Columbia
Rendering Pipeline Fall, 2015.
- Introduction - Graphics Pipeline
Week 2 - Friday CS361.
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
3D Transformations Source & Courtesy: University of Wisconsin,
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.
Graphics Processing Unit
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Transformations 3 University of British Columbia
(c) 2002 University of Wisconsin, CS 559
Lecture 8: 3D Transforms Li Zhang Spring 2008
Transformations 2 University of British Columbia
Presentation transcript:

© Wolfgang Heidrich University of British Columbia Geometric Transformations recap recap composition of transformations composition of transformations rendering pipeline overview rendering pipeline overview recap recap composition of transformations composition of transformations rendering pipeline overview rendering pipeline overview

© Tamara Munzner University of British Columbia News newsgroup is workingnewsgroup is working labs start today, CICSR 011labs start today, CICSR 011 –waitlisted: pick a lab, attend to hear TA talk –accounts: newsgroup answer on activate/reenable readingsreadings –Chap 1: graphics overview –Chap 2: graphics programming –Chap 4: transformations

© Tamara Munzner University of British Columbia Transformations recap Affine transformations linear transformation + translationslinear transformation + translations can be expressed as a 3x3 matrix + 3 vectorcan be expressed as a 3x3 matrix + 3 vector Homogeneous coordinates Unified representation as 4-vector (in 3D) forUnified representation as 4-vector (in 3D) for –Points –Vectors / directions Affine transformations become 4x4 matricesAffine transformations become 4x4 matrices –Composing multiple affine transformations involves simply multiplying the matrices

© Tamara Munzner University of British Columbia Homogeneous Coordinates Homogeneous representation of points: Add an additional component w=1 to all pointsAdd an additional component w=1 to all points All multiples of this vector are considered to represent the same 3D pointAll multiples of this vector are considered to represent the same 3D point why bother? need unified representationwhy bother? need unified representation

© Tamara Munzner University of British Columbia Geometrically In 2D Cartesian Coordinates: x y

© Tamara Munzner University of British Columbia Geometrically In 2D Homogeneous Coordinates: x y w w=1

© Tamara Munzner University of British Columbia Homogeneous Matrices Affine Transformations

© Tamara Munzner University of British Columbia Homogeneous Matrices Combining the two matrices into one:

© Tamara Munzner University of British Columbia Homogeneous Matrices Note: Multiplication of the matrix with a constant does not change the transformation!Multiplication of the matrix with a constant does not change the transformation! normalize: divide by w

© Tamara Munzner University of British Columbia Homogeneous Vectors point: w >= 1 What about vectors (directions)?What about vectors (directions)? What is the affine transformation of a vector?What is the affine transformation of a vector? –Rotation –Scaling –Translation Vectors are invariant under translation!

© Tamara Munzner University of British Columbia Homogeneous Vectors Representing vectors/directions in homogeneous coordinates Need representation that is only affected by linear transformations, but not by translationsNeed representation that is only affected by linear transformations, but not by translations Answer: w=0Answer: w=0

© Tamara Munzner University of British Columbia Transformationstranslate(a,b,c) scale(a,b,c)

© Tamara Munzner University of British Columbia Transformations Arriving at a transformation... FhFhFhFh FWFWFWFW FhFhFhFh object defined in local coords place object in world

© Tamara Munzner University of British Columbia Transformations Arriving at a transformation... FWFWFWFW FhFhFhFh hw

© Tamara Munzner University of British Columbia Transformations How about the following? shear

© Tamara Munzner University of British Columbia Composing Transformations translation so translations add

© Tamara Munzner University of British Columbia Composing Transformations scalingrotation so scales multiply so rotations add

© Tamara Munzner University of British Columbia Composing Transformations Ta Tb = Tb Ta, but Ra Rb != Rb Ra and Ta Rb != Rb Ta

© Tamara Munzner University of British Columbia Composing Transformations FhFhFhFh FWFWFWFW suppose we want FWFWFWFW FhFhFhFhRotate(z,-90) FWFWFWFW FhFhFhFhTranslate(2,3,0)

© Tamara Munzner University of British Columbia Composing Transformations R-to-L: interpret operations wrt fixed coords [object]R-to-L: interpret operations wrt fixed coords [object] L-to-R: interpret operations wrt local coords [coord sys]L-to-R: interpret operations wrt local coords [coord sys] OpenGL (L-to-R, local coords)OpenGL (L-to-R, local coords)glTranslatef(2,3,0);glRotatef(-90,0,0,1); updates current transformation matrix by postmultiplying Which direction to read?

© Tamara Munzner University of British Columbia Composing Transformations Undoing Transformations: inverses (R is orthogonal)

© Tamara Munzner University of British Columbia Rotation about a point FWFWFWFW translate P to origin rotate about P by : P by : rotate about origin translate P back

© Tamara Munzner University of British Columbia Composing of Linear Transformations In general: Transformation of geometry into coordinate system where operation becomes simplerTransformation of geometry into coordinate system where operation becomes simpler Perform operationPerform operation Transform geometry back to original coordinate systemTransform geometry back to original coordinate system Also works for affine transformations

© Tamara Munzner University of British Columbia Composing of Affine Transformations Example: Rotation around arbitrary center

© Tamara Munzner University of British Columbia Composing of Affine Transformations Example: Rotation around arbitrary center Step 1: translate coordinate system to rotation centerStep 1: translate coordinate system to rotation center

© Tamara Munzner University of British Columbia Composing of Affine Transformations Example: Rotation around arbitrary center Step 2: perform rotationStep 2: perform rotation

© Tamara Munzner University of British Columbia Composing of Affine Transformations Example: Rotation around arbitrary center Step 3: back to original coordinate systemStep 3: back to original coordinate system

© Tamara Munzner University of British Columbia Rotation about an arbitrary axis axis defined by two pointsaxis defined by two points translate point to the origintranslate point to the origin rotate to align axis with z-axis (or x or y)rotate to align axis with z-axis (or x or y) perform rotationperform rotation undo aligning rotationsundo aligning rotations undo translationundo translation

© Wolfgang Heidrich University of British Columbia The Rendering Pipeline – An Overview

© Tamara Munzner University of British Columbia 3D Graphics Modeling: Representing object propertiesRepresenting object properties –Geometry: polygons, smooth surfaces etc. –Materials: reflection models etc. Rendering: Generation of images from modelsGeneration of images from models –Interactive rendering –Ray-tracing Animation: Making geometric models move and deformMaking geometric models move and deform

© Tamara Munzner University of British Columbia Rendering Goal: Transform computer models into imagesTransform computer models into images May or may not be photo-realisticMay or may not be photo-realistic Interactive rendering: Fast, but until recently low qualityFast, but until recently low quality Roughly follows a fixed patterns of operationsRoughly follows a fixed patterns of operations  Rendering Pipeline Offline rendering: Ray-tracingRay-tracing Global illuminationGlobal illumination

© Tamara Munzner University of British Columbia Rendering Tasks that need to be performed (in no particular order): Project all 3D geometry onto the image planeProject all 3D geometry onto the image plane Geometric transformationsGeometric transformations Determine which primitives or parts of primitives are visibleDetermine which primitives or parts of primitives are visible Hidden surface removalHidden surface removal Determine which pixels a geometric primitive coversDetermine which pixels a geometric primitive covers Scan conversionScan conversion Compute the color of every visible surface pointCompute the color of every visible surface point Lighting, shading, texture mappingLighting, shading, texture mapping

© Tamara Munzner University of British Columbia The Rendering Pipeline What is it? All of this: Abstract model for sequence of operations to transform a geometric model into a digital imageAbstract model for sequence of operations to transform a geometric model into a digital image An abstraction of the way graphics hardware worksAn abstraction of the way graphics hardware works The underlying model for application programming interfaces (APIs) that allow the programming of graphics hardwareThe underlying model for application programming interfaces (APIs) that allow the programming of graphics hardware OpenGLOpenGL Direct 3DDirect 3D Actual implementations of the rendering pipeline will vary in the details

© Tamara Munzner University of British Columbia The Rendering Pipeline GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping ScanConversionScanConversion DepthTestDepthTest TexturingTexturing BlendingBlending Frame-bufferFrame-buffer

© Tamara Munzner University of British Columbia The Rendering Pipeline Geometry Database Geometry database: Application-specific data structure for holding geometric informationApplication-specific data structure for holding geometric information Depends on specific needs of applicationDepends on specific needs of application –Independent triangles, connectivity information etc. GeometryDatabaseGeometryDatabase

© Tamara Munzner University of British Columbia The Rendering Pipeline Model/View Transformation Modeling transformation: Map all geometric objects from a local coordinate system into a world coordinate systemMap all geometric objects from a local coordinate system into a world coordinate system Viewing transformation: Map all geometry from world coordinates into camera coordinatesMap all geometry from world coordinates into camera coordinates GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform.

© Tamara Munzner University of British Columbia The Rendering Pipeline Lighting Lighting: Compute the brightness of every point based on its material properties (e.g. Lambertian diffuse) and the light position(s)Compute the brightness of every point based on its material properties (e.g. Lambertian diffuse) and the light position(s) Computation is performed per-vertexComputation is performed per-vertex GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLighting

© Tamara Munzner University of British Columbia The Rendering Pipeline Perspective Transformation Perspective transformation Projecting the geometry onto the image planeProjecting the geometry onto the image plane Projective transformations and model/view transformations can all be expressed with 4x4 matrix operationsProjective transformations and model/view transformations can all be expressed with 4x4 matrix operations GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.

© Tamara Munzner University of British Columbia The Rendering Pipeline Clipping Clipping Removal of parts of the geometry that fall outside the visible screen or window regionRemoval of parts of the geometry that fall outside the visible screen or window region May require re-tessellation of geometryMay require re-tessellation of geometry GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping

© Tamara Munzner University of British Columbia The Rendering Pipeline Scan Conversion GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping ScanConversionScanConversion

© Tamara Munzner University of British Columbia The Rendering Pipeline Scan Conversion Scan conversion Turning 2D drawing primitives (lines, polygons etc.) into individual pixels (discretizing/sampling)Turning 2D drawing primitives (lines, polygons etc.) into individual pixels (discretizing/sampling) Interpolation of colors across the geometric primitiveInterpolation of colors across the geometric primitive This yields a fragment (pixel data associated with a particular location in the final image and color values, depth, and some additional information)This yields a fragment (pixel data associated with a particular location in the final image and color values, depth, and some additional information)

© Tamara Munzner University of British Columbia The Rendering Pipeline Texture Mapping GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping ScanConversionScanConversionTexturingTexturing

© Tamara Munzner University of British Columbia The Rendering Pipeline Texture Mapping Texture mapping “gluing images onto geometry”“gluing images onto geometry” The color of every fragment is altered by looking up a new color value from an imageThe color of every fragment is altered by looking up a new color value from an image

© Tamara Munzner University of British Columbia The Rendering Pipeline Depth Test GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping ScanConversionScanConversion DepthTestDepthTest TexturingTexturing

© Tamara Munzner University of British Columbia The Rendering Pipeline Depth Test Depth test: Removes parts of the geometry that are hidden behind other geometryRemoves parts of the geometry that are hidden behind other geometry Test is performed on every individual fragmentTest is performed on every individual fragment –we will also discuss other approaches later

© Tamara Munzner University of British Columbia The Rendering Pipeline Blending GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping ScanConversionScanConversion DepthTestDepthTest TexturingTexturing BlendingBlending

© Tamara Munzner University of British Columbia The Rendering Pipeline Blending Blending: Fragments are written to pixels in the final imageFragments are written to pixels in the final image Rather than simply replacing the previous color value, the new and the old value can be combined with some arithmetic operations (blending)Rather than simply replacing the previous color value, the new and the old value can be combined with some arithmetic operations (blending) The video memory on the graphics board that holds the resulting image and is used to display it is called the framebufferThe video memory on the graphics board that holds the resulting image and is used to display it is called the framebuffer

© Tamara Munzner University of British Columbia The Rendering Pipeline GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping ScanConversionScanConversion DepthTestDepthTest TexturingTexturing BlendingBlending Frame-bufferFrame-buffer

© Tamara Munzner University of British Columbia Discussion Advantages of a pipeline structure Logical separation of the different components, modularityLogical separation of the different components, modularity Easy to parallelize:Easy to parallelize: –Earlier stages can already work on new data while later stages still work with previous data –Similar to pipelining in modern CPUs –But much more aggressive parallelization possible (special purpose hardware!) –Important for hardware implementations! Only local knowledge of the scene is necessaryOnly local knowledge of the scene is necessary

© Tamara Munzner University of British Columbia Discussion Disadvantages: Limited flexibilityLimited flexibility Some algorithms would require different ordering of pipeline stagesSome algorithms would require different ordering of pipeline stages –Hard to achieve while still preserving compatibility Only local knowledge of scene is availableOnly local knowledge of scene is available –Shadows –Global illumination