Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 4: 3D Rendering Pipeline (I) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology.

Similar presentations


Presentation on theme: "Lecture 4: 3D Rendering Pipeline (I) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology."— 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 Game Input (Keyboard, Mouse) Physics Strategy, AI Render Triangles (one frame) Exit? Cleanup States 30 to 60 frames per second

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

4 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 Geometry Processing x y z x y z x y z x y z x y z x y Rasterization Processing x y MMX ISA

5 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 Geometry Processing x y z x y z x y z x y z x y z x y Rasterization Processing x y MMX ISA SSE/SSE2 ISA

6 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 Geometry Processing x y z x y z x y z x y z x y z x y Rasterization Processing x y Performed by (GP)GPU

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

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

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

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

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

12 Specifying a 3D object Vertex ordering is critical V1 V2V3 V4 V5 V6V7 Triangle list {v1, v3, v2}, {v1, v5, v3}, {v5, v6, v3}, {v4, v3, v6}, {v1, v7, v6}, {v1, v6, v5} Triangle strip {v5, v3, v1, v2}, {v5, v6, v3, v4}, {v7, v6, v1, v5}

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

14 3D Rendering Pipeline ClippingPerspective DivideViewport Transform Rasterization Projection TransformWorld TransformView TransformLightingBackface Culling

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 +x +z +y World origin World Coordinates Local model coordinates

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

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) +x +z +y +x +z +y (x, y, z) (x t, y t, z t )

21 Translation Matrix

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

23 Scaling Matrix

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

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

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

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

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

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

30 Non-Commutative Property (2) +x +z +y   +x +z +y    (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) Offsets were scaled as well

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


Download ppt "Lecture 4: 3D Rendering Pipeline (I) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology."

Similar presentations


Ads by Google