1 / 20

3D Rendering Praktikum: Shader Gallery

3D Rendering Praktikum: Shader Gallery. The Rendering Pipeline. The Rendering Pipeline …. … what an „end user“ sees. The Rendering Pipeline …. … in pictures. Objects in 3D world. Geometry subsystem. 2D primitives. Raster subsystem. Color image. Rendering pipeline. User / Driver.

dessa
Télécharger la présentation

3D Rendering Praktikum: Shader Gallery

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 3D Rendering Praktikum:Shader Gallery The Rendering Pipeline

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

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

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

  5. User / Driver Vertex Stage Pixel Stage Texture 0 Texture 1 Texture 2 Texture 3 Overview Transform & Lighting Rasterizer Texturing Blending/Ops Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group

  6. Objects in 3D world Geometry subsystem 2D primitives Raster subsystem Color image Rendering pipeline Object coordinates Modelling transform affine World coordinates Model-View-Transformation Viewing transform affine Eye coordinates Normalizing transform Normalized (Clip-)coord. clipping 2D Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group

  7. 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 Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group

  8. Point representation • Represent as row or column vector • Affects the kind of matrices we can multiply with Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group

  9. Transformation representation • Represent 2D transformations by a 2x2 matrix • If the point is a column vector • If the point is a row vector Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group

  10. Linear transformations • Scaling • Reflection S sx = sy uniform scaling Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group

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

  12. T Homogeneous coordinates! 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 Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group

  13. General Camera Setup • Look at: • Position • Orientation • Frustum: • Camera parameters • Viewport: • 2D coordinate system Look at Frustum Viewport Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group

  14. Camera look at • Move camera C to originTranslate by –C • Build orthonormal frame„right“ R=DxU„zenith“ U=RxD • Adjust orientationRotation [R,U,D][X,Y,-Z] Up View direction Right Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group

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

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

  17. User / Driver Vertex Stage Pixel Stage Texture 0 Texture 1 Texture 2 Texture 3 Overview Transform & Lighting Rasterizer Texturing Blending/Ops Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group

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

  19. 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--; } } } Problem: • still floating point arithmetic Obersvation: • m is rational • d is rational Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group

  20. 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; } } } Introduce the following integer variables: Kai Bürger & Polina Kondratieva – Computer Graphics and Visualization Group

More Related