Download presentation
Presentation is loading. Please wait.
1
© 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
2
© 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
3
© 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
4
© 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
5
© Tamara Munzner University of British Columbia Geometrically In 2D Cartesian Coordinates: x y
6
© Tamara Munzner University of British Columbia Geometrically In 2D Homogeneous Coordinates: x y w w=1
7
© Tamara Munzner University of British Columbia Homogeneous Matrices Affine Transformations
8
© Tamara Munzner University of British Columbia Homogeneous Matrices Combining the two matrices into one:
9
© 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
10
© 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!
11
© 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
12
© Tamara Munzner University of British Columbia Transformationstranslate(a,b,c) scale(a,b,c)
13
© Tamara Munzner University of British Columbia Transformations Arriving at a transformation... FhFhFhFh FWFWFWFW FhFhFhFh object defined in local coords place object in world
14
© Tamara Munzner University of British Columbia Transformations Arriving at a transformation... FWFWFWFW FhFhFhFh hw
15
© Tamara Munzner University of British Columbia Transformations How about the following? shear
16
© Tamara Munzner University of British Columbia Composing Transformations translation so translations add
17
© Tamara Munzner University of British Columbia Composing Transformations scalingrotation so scales multiply so rotations add
18
© Tamara Munzner University of British Columbia Composing Transformations Ta Tb = Tb Ta, but Ra Rb != Rb Ra and Ta Rb != Rb Ta
19
© Tamara Munzner University of British Columbia Composing Transformations FhFhFhFh FWFWFWFW suppose we want FWFWFWFW FhFhFhFhRotate(z,-90) FWFWFWFW FhFhFhFhTranslate(2,3,0)
20
© 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?
21
© Tamara Munzner University of British Columbia Composing Transformations Undoing Transformations: inverses (R is orthogonal)
22
© 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
23
© 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
24
© Tamara Munzner University of British Columbia Composing of Affine Transformations Example: Rotation around arbitrary center
25
© 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
26
© Tamara Munzner University of British Columbia Composing of Affine Transformations Example: Rotation around arbitrary center Step 2: perform rotationStep 2: perform rotation
27
© 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
28
© 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
29
© Wolfgang Heidrich University of British Columbia The Rendering Pipeline – An Overview
30
© 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
31
© 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
32
© 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
33
© 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
34
© Tamara Munzner University of British Columbia The Rendering Pipeline GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping ScanConversionScanConversion DepthTestDepthTest TexturingTexturing BlendingBlending Frame-bufferFrame-buffer
35
© 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
36
© 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.
37
© 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
38
© 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.
39
© 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
40
© Tamara Munzner University of British Columbia The Rendering Pipeline Scan Conversion GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping ScanConversionScanConversion
41
© 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)
42
© Tamara Munzner University of British Columbia The Rendering Pipeline Texture Mapping GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping ScanConversionScanConversionTexturingTexturing
43
© 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
44
© Tamara Munzner University of British Columbia The Rendering Pipeline Depth Test GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping ScanConversionScanConversion DepthTestDepthTest TexturingTexturing
45
© 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
46
© Tamara Munzner University of British Columbia The Rendering Pipeline Blending GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping ScanConversionScanConversion DepthTestDepthTest TexturingTexturing BlendingBlending
47
© 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
48
© Tamara Munzner University of British Columbia The Rendering Pipeline GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform.ClippingClipping ScanConversionScanConversion DepthTestDepthTest TexturingTexturing BlendingBlending Frame-bufferFrame-buffer
49
© 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
50
© 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.