The Rendering Pipeline
Total Page:16
File Type:pdf, Size:1020Kb
The Rendering Pipeline Framebuffers • Framebuffer is the interface between the device and the computer’s notion of an image • A memory array in which the computer stores an image – On most computers, separate memory bank from main memory – Many different variations, motivated by cost of memory Framebuffers: True-Color • A true-color (aka 24-bit or 32-bit) framebuffer stores one byte each for red, green, and blue • Each pixel can thus be one of 224 colors • Pay attention to Endian-ness • How can 24-bit and 32-bit mean the same thing here? Framebuffers: Indexed-Color • An indexed-color (8-bit or PseudoColor) framebuffer stores one byte per pixel (also: GIF image format) • This byte indexes into a color map: • How many colors can a pixel be? • Common on low-end displays (cell phones, PDAs, GameBoys) Framebuffers: Indexed Color Illustration of how an indexed palette works A 2-bit indexed-color image. The color of each pixel is represented by a number; each number corresponds to a color in the palette. Image credits: Wikipedia Framebuffers: Hi-Color • Hi-Color is (was?) a popular PC SVGA standard • Packs pixels into 16 bits: – 5 Red, 6 Green, 5 Blue (why would green get more?) – Sometimes just 5,5,5 • Each pixel can be one of 216 colors • Hi-color images can exhibit worse quantization artifacts than a well-mapped 8-bit image Color Quantization A process that reduces the number of distinct colors used in an image Intention that the new image should be as visually similar as possible to the original image Image credits: Wikipedia The Rendering Pipeline: A Tour Transform Illuminate Transform Clip Project Rasterize Model & Camera Rendering Pipeline Framebuffer Display Parameters The Display You Know Transform Illuminate Transform Clip Project Rasterize Model & Camera Rendering Pipeline Framebuffer Display Parameters The Framebuffer You Know Transform Illuminate Transform Clip Project Rasterize Model & Camera Rendering Pipeline Framebuffer Display Parameters The Rendering Pipeline Transform Illuminate Transform Clip Project Rasterize Model & Camera Rendering Pipeline Framebuffer Display Parameters 2-D Rendering: Rasterization Transform Illuminate Transform Clip Project Rasterize Model & Camera Rendering Pipeline Framebuffer Display Parameters The Rendering Pipeline: 3-D Transform Illuminate Transform Clip Project Rasterize Model & Camera Rendering Pipeline Framebuffer Display Parameters The Rendering Pipeline: 3-D Scene graph Object geometry Result: Modeling • All vertices of scene in shared 3-D “world” coordinate Transforms system Lighting Calculations • Vertices shaded according to lighting model Viewing • Scene vertices in 3-D “view” or “camera” coordinate Transform system • Exactly those vertices & portions of polygons in view Clipping frustum Projection • 2-D screen coordinates of clipped vertices Transform The Rendering Pipeline: 3-D Scene graph Object geometry Result: Modeling • All vertices of scene in shared 3-D “world” coordinate Transforms system Lighting Calculations • Vertices shaded according to lighting model Viewing • Scene vertices in 3-D “view” or “camera” coordinate Transform system • Exactly those vertices & portions of polygons in Clipping view frustum Projection • 2-D screen coordinates of clipped vertices Transform Rendering: Transformations • So far, discussion has been in screen space • But model is stored in model space (a.k.a. object space or world space) • Three sets of geometric transformations: – Modeling transforms – Viewing transforms – Projection transforms The Rendering Pipeline: 3-D Scene graph Object geometry Result: Modeling • All vertices of scene in shared 3-D “world” coordinate Transforms system Lighting Calculations • Vertices shaded according to lighting model Viewing • Scene vertices in 3-D “view” or “camera” coordinate Transform system • Exactly those vertices & portions of polygons in view Clipping frustum Projection • 2-D screen coordinates of clipped vertices Transform Rendering: 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 time The Rendering Pipeline: 3-D Scene graph Object geometry Result: Modeling • All vertices of scene in shared 3-D “world” coordinate Transforms system Lighting Calculations • Vertices shaded according to lighting model Viewing • Scene vertices in 3-D “view” or “camera” coordinate Transform system • Exactly those vertices & portions of polygons in Clipping view frustum Projection • 2-D screen coordinates of clipped vertices Transform Rendering: Clipping • Clipping a 3-D primitive returns its intersection with the view frustum: Rendering: Clipping • Clipping is tricky! In: 3 vertices Clip Out: 6 vertices Clip In: 1 polygon Out: 2 polygons The Rendering Pipeline: 3-D Transform Illuminate Transform Clip Project Rasterize Model & Camera Rendering Pipeline Framebuffer Display Parameters Trivia The first blockbuster to use CGs was Star Wars in 1977. The 40-second Death Star simulation sequence took the animation company Cuba 12 weeks to produce! http://www.youtube.com/watch?v=4bSefSLaPFs .