1 / 31

Lecture 4: 3D Rendering Pipeline (I)

Lecture 4: 3D Rendering Pipeline (I). Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology. Interactive Game Loop. Render Triangles (one frame). Game Input (Keyboard, Mouse). Physics Strategy, AI. 30 to 60 frames per second. Exit?.

Download Presentation

Lecture 4: 3D Rendering Pipeline (I)

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. Lecture 4: 3D Rendering Pipeline (I) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology

  2. Interactive Game Loop Render Triangles (one frame) Game Input (Keyboard, Mouse) Physics Strategy, AI 30 to 60 frames per second Exit? Cleanup States

  3. z z z z z y y y y y x x x x x 3D Graphics Rendering Pipeline • Geometry Pipeline • Processing Vertices • Mainly floating-point operations • Rasterization Pipeline • Processing Pixels • Mainly dealing with Integer operations y Geometry Processing Rasterization Processing x y x

  4. z z z z z y y y y y x x x x x 3D Graphics Rendering Pipeline • Geometry Pipeline • Processing Vertices • Mainly floating-point operations • Rasterization Pipeline • Processing Pixels • Mainly dealing with Integer operations • MMX was originally designed to accelerate this functionality MMX ISA y Geometry Processing Rasterization Processing x y x

  5. z z z z z y y y y y x x x x x 3D Graphics Rendering Pipeline • Geometry Pipeline • Processing Vertices • Mainly floating-point operations • SSE/SSE2 were designed for this part • Rasterization Pipeline • Processing Pixels • Mainly dealing with Integer operations • MMX was originally designed to accelerate this functionality SSE/SSE2 ISA MMXISA y Geometry Processing Rasterization Processing x y x

  6. z z z z z y y y y y x x x x x Fixed Function 3D Graphics Pipeline • Geometry Pipeline • Processing Vertices • Mainly floating-point operations • SSE/SSE2 were designed for this part • Rasterization Pipeline • Processing Pixels • Mainly dealing with Integer operations • MMX was originally designed to accelerate this functionality y Geometry Processing Rasterization Processing x Performed by (GP)GPU y x

  7. +y +y +z +x +x +z Right-Handed System Left-Handed System 3D Coordinates • Left-handed system is more common for graphics viewing space • Camera or viewer position can be set up using 3D API

  8. Geometry Format ─ Vertex Coordinates +Y (X2, Y2, Z2) +Z (X3, Y3, Z3) (X1, Y1, Z1) Y1 Z1 +X X1

  9. Geometry Format ─ Vertex Normals +Y (NX2, NY2, NZ2) +Z (NX3, NY3, NZ3) (NX1, NY1, NZ1) +X

  10. Geometry Format ─ Vertex Colors +Y (R2, G2, B2, A2) +Z (R3, B3, B3, G3) (R1, G1, B1, A1) +X

  11. Triangle-based Geometry Representation V1 V4 V4 V5 V2 V5 V5 V4 V3 V2 V3 V6 V7 V3 V1 V9 V1 V8 V2 Triangle List (note the vertex order) Triangle Strip Triangle Fan

  12. Specifying a 3D object • Vertex ordering is critical Triangle list {v1, v3, v2}, {v1, v5, v3}, {v5, v6, v3}, {v4, v3, v6}, {v1, v7, v6}, {v1, v6, v5} V7 V6 V1 V5 Triangle strip {v5, v3, v1, v2}, {v5, v6, v3, v4}, {v7, v6, v1, v5} V4 V2 V3

  13. Specifying a 3D object • Vertex ordering is critical • We will discuss normal computation later in this lecture Triangle list {v1, v2, v7}, {v2, v8, v7}, {v2, v3, v4}, {v2, v4, v8}, {v4, v7, v8}, {v4, v6, v7} V7 V6 V1 Triangle strip {v1, v2, v7, v8}, {v3, v4, v2, v8}, {v6, v7, v4, v8} V8 V4 V2 V3

  14. Clipping Perspective Divide Viewport Transform Projection Transform World Transform View Transform Lighting Backface Culling Rasterization 3D Rendering Pipeline

  15. Transformation Pipeline • World Transformation • Model coordinates  World coordinates • View Transformation • World coordinates  Camera space • Projection Transformation • Camera space  View Plane • These are a series of matrix multiplications

  16. World Transformation • Translation • Rotation • Scaling World Coordinates +y Local model coordinates +z World origin +x Local model coordinates

  17. View Transformation World Coordinates +y +z • Camera position • Look vector +z +y +x World origin +x

  18. Projection Transformation • Set up camera internals • Set up • Field of View (FOV) • View frustum • View planes • Will discuss later

  19. Homogeneous Coordinates • Enable all transformations to be done by “multiplication” • Primarily for translation (See next few slides) • Add one coordinate (w) to a 3D vector • Each vertex has [x, y, z, w] • W will be useful for perspective projection • W should be 1 in a Cartesian Coordinate System

  20. Transformation 1: Translation (Offset) +y +y (xt, yt, zt) +z +z (x, y, z) +x +x

  21. Translation Matrix

  22. Transformation 2: Scaling +y +y +z +z +x +x

  23. Scaling Matrix

  24. +x +y +z Transformation 3: Rotation +y +z +x

  25. 2D Rotation +y +y (x, y)  +x +x +y (x’, y’) (x, y)   +x Rotate along which axis?

  26. 3D Rotation Matrix Rotation along Z axis Rotation along Y axis Rotation along X axis

  27. +y +z    +x  Non-Commutative Property (1) +y +z +x • Counter-clockwise 90o along y • Clockwise 90o along x • Clockwise 90o along x • Counter-clockwise 90o along y

  28. +y +y +z +z    +x +x  Non-Commutative Property (1)   (x’’, y’’, z’’) = (-z, -x, y)   (x’’, y’’, z’’) = (-y, -z, x)

  29. +y +z    +x Non-Commutative Property (2) +y +z +x • Translation by (x, y, z) • Scale by 2 times • Scale by 2 times • Translation by (x, y, z)

  30. +y  +y +z +z   Offsets were scaled as well  +x +x Non-Commutative Property (2)   (x’’, y’’, z’’) = (x*Rx+Rx*Tx, y*Ry+Ry*Ty, z*Rz+Rz*Tz)   (x’’, y’’, z’’) = (x*Rx+Tx, y*Ry+Ty, z*Rz+Tz)

  31. Non-Commutative Property • Ordering matters ! • Be careful when performing matrix multiplication

More Related