290 likes | 516 Views
Under the Hood: 3D Pipeline. Motherboard & Chipset. PCI Express x16. Discrete 3D Graphics Architecture. Graphics Sub-System. CPU. Local Memory. System Memory. 3 D GFX. North Bridge. AGP / PCI-E. South Bridge. Display Devices. Frame Buffer Z-Buffer Texture Vertex….
E N D
Motherboard & Chipset PCI Express x16
Discrete 3D Graphics Architecture Graphics Sub-System CPU Local Memory System Memory 3D GFX North Bridge AGP / PCI-E South Bridge Display Devices Frame Buffer Z-Buffer Texture Vertex…
Discrete Graphics Cards • NVIDIA • ATI
Local Memory Integrated 3D Graphics (Unified Memory Architecture) Graphics Sub-System CPU Optional Local Memory System Memory 3D GFX NB + 3D GFX AGP / PCI-E Display Devices South Bridge Display Devices Frame Buffer Z-Buffer Texture Vertex…
Keep in mind that… 3D graphics processor works in parallel to the CPU
Many Views of Graphics Pipeline • Simple “Front-End/Back-End” view. • Textbook version in [Foley/van Dam]. • David Kirk’s (nVidia CTO) version presented in EG Hardware Workshop 1998: (slide 05) http://www.merl.com/hwws98/presentations/kirk/index.htm
Simplified View • The Data Flow: 3D Polygons (+Colors, Lights, Normals, Texture Coordinates…etc.) • 2D Polygons • 2D Pixels (I.e., Output Images) Transform (& Lighting) Rasterization
Triangles Transform & Lighting Transform & Lighting Triangle Setup Rasterization Rasterization Rasterization Rasterization Texture Mapping Texture Mapping Texture Mapping Rendering Rendering Rendering Rendering Conventional 3D Graphics Pipeline Evolution of 3D Graphics Hardware Triangles Surface Engine Transform & Lighting Vertex Shader Triangle Setup Pixel Shader Rasterization Texture Mapping Rendering
A Quick Review • By default, graphic pipeline will do the following: • Take as input various per-vertex quantities (color, light source, eye point, texture coordinates, etc.) • Calculate a final color for each vertex using a basic lighting model (OpenGL uses Phong lighting) • For each pixel, linearly interpolate the three surrounding vertex colors to shade the pixel (OpenGL uses Gouraud shading) • Write the pixel color value to the frame buffer
Why Need Hardware • All parts of graphics pipeline can be done in software. • But very slowly. • Example: mesaGL • For some applications, speed is beauty • Games • Walkthrough • Visualization
Evolutions of Graphics Hardware • Gouraud-shaded polygons. • Then came antialiasing. • Then came texture mapping. • Now comes programmable shading.
Fixed vs. Programmable • Starting in 1999 some graphics cards used the standard lighting model and Gouraud shading to draw polygon fragments entirely in hardware • Implementing the pipeline in hardware made processing polygons much faster, but the developer could not modify the pipeline (hence “fixed function pipeline”) • New programmable hardware allows programmers to write vertex and pixel programs to change the pipeline
OpenGLFixed Function Vertex Vertex (object) Vertex (clip) Transform[MVP],[MV],[MV]-T Normal Vertex (eye) ColorSecondaryColor Front&BackColor [0,1] Lighting Front&BackSecondaryColor [0,1] Texgen TextureMatrixn TexCoordn TexCoordn EdgeFlag EdgeFlag
OpenGLFixed Function Fragment Color SecondaryColor Texn TEn Sum Fog TexCoord[n] Color [0,1] z (|ze|,f ) Depth Depth Coord Coord FrontFacing FrontFacing
Programmable Shaders • A concept made popular by Pixar’s RenderMan. • First appeared in hardware: UNC PixelFlow • See SIGGRAPH papers by Molnar 1995 and Olano 1997. • Made affordable by nVidia GeForce3 and XBox.
GL2 Vertex Processor Vertex (object) Vertex (clip) Uniform Normal Vertex (eye) ColorSecondaryColor VertexShader Front&BackColor Front&BackSecondaryColor TexCoordn Temporaries TexCoordn EdgeFlag EdgeFlag
GL2 Fragment Processor Color Texture Uniform SecondaryColor FragmentShader TexCoord[n] Color z (|ze|,f ) Depth Depth Temporaries Coord Coord FrontFacing FrontFacing