The Rendering PipelineAdminRecap: The Rendering PipelineSlide 4Recap: TransformationsSlide 6Slide 7Slide 8Rendering: TransformationsThe Rendering Pipeline: 3-DRendering: LightingSlide 12Rendering: ClippingSlide 14Slide 15Modeling: The BasicsModeling: The Scene GraphSlide 18Modeling: The CameraSlide 20The Rendering Pipeline CS 445/645Introduction to Computer GraphicsDavid Luebke, Spring 2003David Luebke 2 01/13/19Admin●Call roll●Assignment 1David Luebke 3 01/13/19Recap: The Rendering PipelineTransformIlluminateTransformClipProjectRasterizeModel & CameraModel & CameraParametersParametersRendering PipelineRendering PipelineFramebufferFramebufferDisplayDisplayDavid Luebke 4 01/13/19Recap: The Rendering PipelineModelingTransformsScene graphObject geometryLightingCalculationsViewingTransformClippingProjectionTransformResult:Result:• All vertices of scene in shared 3-D “world” coordinate All vertices of scene in shared 3-D “world” coordinate systemsystem• Vertices shaded according to lighting modelVertices shaded according to lighting model• Scene vertices in 3-D “view” or “camera” coordinate Scene vertices in 3-D “view” or “camera” coordinate systemsystem• Exactly those vertices & portions of polygons in view Exactly those vertices & portions of polygons in view frustumfrustum• 2-D screen coordinates of clipped vertices2-D screen coordinates of clipped verticesDavid Luebke 5 01/13/19Recap: Transformations●Modeling transforms■Size, place, scale, and rotate objects parts of the model w.r.t. each other■Object coordinates world coordinatesZXYXZYDavid Luebke 6 01/13/19Recap: Transformations●Viewing transform■Rotate & translate the world to lie directly in front of the camera○Typically place camera at origin○Typically looking down -Z axis■World coordinates view coordinatesDavid Luebke 7 01/13/19Recap: Transformations●Projection transform■Apply perspective foreshortening○Distant = small: the pinhole camera model■View coordinates screen coordinatesDavid Luebke 8 01/13/19Recap: Transformations●All these transformations involve shifting coordinate systems (i.e., basis sets)●That’s what matrices do…●Represent coordinates as vectors, transforms as matrices●Multiply matrices = concatenate transforms!YXYXcossinsincosDavid Luebke 9 01/13/19Rendering: Transformations●Homogeneous coordinates: represent coordinates in 3 dimensions with a 4-vector■Denoted [x, y, z, w]T○Note that w = 1 in model coordinates■To get 3-D coordinates, divide by w:[x’, y’, z’]T = [x/w, y/w, z/w]T●Transformations are 4x4 matrices●Why? To handle translation and projectionDavid Luebke 10 01/13/19The Rendering Pipeline: 3-DModelingTransformsScene graphObject geometryLightingCalculationsViewingTransformClippingProjectionTransformResult:Result:• All vertices of scene in shared 3-D “world” coordinate All vertices of scene in shared 3-D “world” coordinate systemsystem• Vertices shaded according to lighting modelVertices shaded according to lighting model• Scene vertices in 3-D “view” or “camera” coordinate Scene vertices in 3-D “view” or “camera” coordinate systemsystem• Exactly those vertices & portions of polygons in view Exactly those vertices & portions of polygons in view frustumfrustum• 2-D screen coordinates of clipped vertices2-D screen coordinates of clipped verticesDavid Luebke 11 01/13/19Rendering: Lighting●Illuminating a scene: coloring pixels according to some approximation of lighting■Global illumination: solves for lighting of the whole scene at once■Local illumination: local approximation, typically lighting each polygon separately●Interactive graphics (e.g., hardware) does only local illumination at run timeDavid Luebke 12 01/13/19The Rendering Pipeline: 3-DModelingTransformsScene graphObject geometryLightingCalculationsViewingTransformClippingProjectionTransformResult:Result:• All vertices of scene in shared 3-D “world” coordinate All vertices of scene in shared 3-D “world” coordinate systemsystem• Vertices shaded according to lighting modelVertices shaded according to lighting model• Scene vertices in 3-D “view” or “camera” coordinate Scene vertices in 3-D “view” or “camera” coordinate systemsystem• Exactly those vertices & portions of polygons in view Exactly those vertices & portions of polygons in view frustumfrustum• 2-D screen coordinates of clipped vertices2-D screen coordinates of clipped verticesDavid Luebke 13 01/13/19Rendering: Clipping●Clipping a 3-D primitive returns its intersection with the view frustum:David Luebke 14 01/13/19Rendering: Clipping●Clipping is tricky!■We will have a whole assignment on clippingIn: 3 verticesIn: 3 verticesOut: 6 verticesOut: 6 verticesClipClipIn: 1 polygonIn: 1 polygonOut: 2 polygonsOut: 2 polygonsDavid Luebke 15 01/13/19The Rendering Pipeline: 3-DTransformIlluminateTransformClipProjectRasterizeModel & CameraModel & CameraParametersParametersRendering PipelineRendering PipelineFramebufferFramebufferDisplayDisplayDavid Luebke 16 01/13/19Modeling: The Basics●Common interactive 3-D primitives: points, lines, polygons (i.e., triangles)●Organized into objects■Collection of primitives, other objects■Associated matrix for transformations●Instancing: using same geometry for multiple objects ■4 wheels on a car, 2 arms on a robotDavid Luebke 17 01/13/19Modeling: The Scene Graph●The scene graph captures transformations and object-object relationships in a DAG●Nodes are objects; ●Arcs indicate instancing■Each has a matrixRobotBodyHeadArmTrunkLegEyeMouthDavid Luebke 18 01/13/19Modeling: The Scene Graph●Traverse the scene graph in depth-first order, concatenating transformations●Maintain a matrix stack of transformationsArmTrunkLegEyeMouthHead BodyRobotFootMatrixMatrixStackStackVisitedVisitedUnvisitedUnvisitedActiveActiveDavid Luebke 19 01/13/19Modeling: The Camera●Finally: need a model of the virtual camera■Can be very sophisticated○Field of view, depth of field, distortion, chromatic aberration…■Interactive graphics (OpenGL):○Camera pose: position & orientationCaptured in
View Full Document