Presentation is loading. Please wait.

Presentation is loading. Please wait.

Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group computer graphics & visualization 3D Rendering Praktikum: Shader Gallery The.

Similar presentations


Presentation on theme: "Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group computer graphics & visualization 3D Rendering Praktikum: Shader Gallery The."— Presentation transcript:

1 Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group computer graphics & visualization 3D Rendering Praktikum: Shader Gallery The Rendering Pipeline

2 computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group … what an „end user“ sees. The Rendering Pipeline …

3 computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group The Rendering Pipeline … … in pictures

4 computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Rendering pipeline Geometry subsystem Raster subsystem Objects in 3D world Color image 2D primitives

5 computer graphics & visualization Kai Bürger & 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

6 computer graphics & visualization Kai Bürger & 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 affine Model-View-Transformation

7 computer graphics & visualization Kai Bürger & 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 Kai Bürger & 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 Kai Bürger & 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 Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Linear transformations - - Scaling - - Reflection s x = s y uniform scaling S

11 computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Linear transformations - - Shearing - - Rotation around origin by a 1 R(90°)

12 computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Affine transformations - - Affine transformations: parallelism is preserved, length & angles not - - All linear transformations can be written as matrix multiplication - - What about translation ? - - We want to write T Homogeneous coordinates!

13 computer graphics & visualization Kai Bürger & 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 Kai Bürger & 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] Right View direction Up

15 computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Frustum (Perspective Projection) T t B b -f -n -z y

16 computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Last Transformations - - After all the projections we have: - - Perspective division: - - Viewport transformation:

17 computer graphics & visualization Kai Bürger & 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

18 computer graphics & visualization Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group Bresenham (Line Drawing)

19 computer graphics & visualization Kai Bürger & 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 arithmetic Obersvation: m is rational d is rational

20 computer graphics & visualization Kai Bürger & 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:


Download ppt "Jens Krüger & Polina Kondratieva – Computer Graphics and Visualization Group computer graphics & visualization 3D Rendering Praktikum: Shader Gallery The."

Similar presentations


Ads by Google