Download presentation
Presentation is loading. Please wait.
Published byByron Cox Modified over 9 years ago
1
Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group computer graphics & visualization GameFX C# / DirectX 2005 The Rendering Pipeline
2
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group … what an „end user“ sees. The Rendering Pipeline …
3
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group The Rendering Pipeline … … in pictures
4
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Pixel Stage Vertex Stage User / DriverOverview Transform & Lighting Rasterizer Texturing Blending/Ops Texture 3 Texture 2 Texture 1 Texture 0
5
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Rendering pipeline Geometry subsystem Raster subsystem Objects in 3D world Color image 2D primitives
6
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Rendering pipeline Geometry subsystem Raster subsystem Objects in 3D world Color image 2D primitives 2D Object coordinates World coordinates Eye coordinates Modelling transform Viewing transform Normalizing transform Normalized (Clip-)coord. clipping affin Model-View-Transformation
7
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Transformations - A transformation is like a function of a point - Modeling: - Define objects in „convenient“ coordinate systems - Multiply-instantiated geometry - Hierarchically defined linked figures - Viewing: - Window systems - Virtual camera - Perspective transformations
8
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Point representation - Represent as row or column vector - Affects the kind of matrices we can multiply with
9
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Transformation representation - Represent 2D transformations by a 2x2 matrix - If the point is a column vector - If the point is a row vector
10
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Linear transformations - Scaling - Reflection s x = s y uniform scaling S
11
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Linear transformations - Shearing - Rotation around origin by a 1 R(90°)
12
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Affine transformations - All linear transformations can be written as matrix multiplication - What about translation ? - We want to write T homogeneouscoordinates
13
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group General Camera Setup - Look at: - Position - Orientation - Frustum: - Camera parameters - Viewport: - 2D coordinate system Look at FrustumFrustum ViewportViewport
14
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Camera look at - Move camera C to origin Translate by –C - Build orthonormal frame „right“R=DxU „zenith“U=RxD - Adjust orientation Rotation [R,U,D][X,Y,-Z]
15
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Frustum T t B b -f -n -z y
16
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Pixel Stage Vertex Stage User / DriverOverview Transform & Lighting Rasterizer Texturing Blending/Ops Texture 3 Texture 2 Texture 1 Texture 0
17
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Bresenham (Line Drawing)
18
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Getting to Bresenham … /********************************* * Input: * xP: x-value of the startpoint * yP: y-value of the startpoint * xQ: x-value of the endpoint * yQ: y-value of the endpoint *********************************/ function drawLine(int xP, int yP, int xQ, int yQ) { x = xP; y = yP; d = 0; m = (yQ - yP) / (xQ - xP) while(true) { // put the pixel on the screen putPixel(x, y); if(x == xQ) break; x++; d += m; if(d > 0.5) { y++; d--; } /********************************* * Input: * xP: x-value of the startpoint * yP: y-value of the startpoint * xQ: x-value of the endpoint * yQ: y-value of the endpoint *********************************/ function drawLine(int xP, int yP, int xQ, int yQ) { x = xP; y = yP; d = 0; m = (yQ - yP) / (xQ - xP) while(true) { // put the pixel on the screen putPixel(x, y); if(x == xQ) break; x++; d += m; if(d > 0.5) { y++; d--; } Problem: still floating point arithmeticstill floating point arithmeticObersavtion: m is rationalm is rational d is rationald is rational
19
computer graphics & visualization Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group Bresenham … function drawLine(int xP, int yP, int xQ, int yQ) { x = xP; y = yP; D = 0; H = xQ - xP; c = 2 * H; M = 2 * (yQ - yP); while(true) { putPixel(x, y); if(x == xQ) break; x++; D += M; if(D > H) { y++; D -= c; } function drawLine(int xP, int yP, int xQ, int yQ) { x = xP; y = yP; D = 0; H = xQ - xP; c = 2 * H; M = 2 * (yQ - yP); while(true) { putPixel(x, y); if(x == xQ) break; x++; D += M; if(D > H) { y++; D -= c; } Introduce the following integer variables:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.