The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles, polygons)
3D Primitives 2D Primitives PixelsGeometry Stage Rasterization Stage Vertex ProcessingPixel (Fragment) Processing Coordinate Transformation Lighting Calculation Primitive Rasterization Vertex Attribute Interpolation Texture Mapping Raster Operation (ROP) Scissor Test Alpha Test Stencil Test Depth (Z) Test Color Blending
Video Memory Computer Graphics Hardware CPU System Memory Frame Buffer Video Controller Video Display Device Graphics Controller Primitive Data Texture Data Motherboard Graphics Card Bus (PCI, AGP, PCI Express) Graphics Hardware Architecture
The frame buffer: Video memory that holds screen pixel values. Resolution: Number of horizontal and vertical pixels on the screen. The Frame Buffer 0 0 h-1h-1 w-1w-1 (x, y) x y Pixel value Color value Depth (Z) value Stencil value Frame Buffer Stencil Buffer Color Buffer Depth (Z) buffer
Double buffer Front stage and back stage swapping for animation. color buffer 1 color buffer 2 Front stage pointer Back stage pointer color buffer 1 color buffer 2 Front stage pointer Back stage pointer Two color buffers. Front stage for display. Back stage for drawing. Triple buffer Three color buffers. One front stage and two back stages.
Evolution of Graphics Controller Pre 1995: 2D era : First generation of 3D accelerators : GPU (Graphics Processing Unit) 2001: Vertex Shader 2002: Pixel Shader 2006: Geometric Shader Shader Unit: Part of graphics hardware that can be programmed Shader Program: Programs that run on shader units Vertex shader controls vertex processing Pixel shader controls pixel processing Geometric shader generates new geometries
Graphics Controller Rasterization Stage : First generation of 3D accelerators CPU System Memory Graphics Application Geometry Stage 2D Primitives Textures Rasterizer Texture Unit Video Memory ROP Unit 2D Primitives Textures Frame Buffer Bus (PCI)
Products: 3dfx: Voodoo, Voodoo 2, Voodoo 3, Voodoo 5 NVidia: Riva 128, Riva TNT, Riva TNT 2 ATI: Rage 128 Matrox: Mystique Rendition: Verite S3: Savage Features: Primitive rasterization Texture mapping Hardware Z-buffer
: GPU (Graphics Processing Unit) GPU Rasterization Stage CPU System Memory Graphics Application 3D Primitives Textures Rasterizer Multi Texture Unit Video Memory ROP Unit 3D Primitives Textures Frame Buffer Bus (AGP) Texture Combiner Geometry Stage Transformation And Lighting Unit
Representative products: NVidia: Geforce 256, Geforce 2 ATI: Radeon 7500 Features: Hardware transformation and lighting (TnL) Superscalar structure (Multiple vertex and pixel processing units working in parallel) Hardware Z-buffer and Stencil-buffer The demise of 3dfx (2000) and lessons to be learned:
2001: Vertex Shader GPU Rasterization Stage CPU System Memory Graphics Application 3D Primitives Textures Rasterizer Multi Texture Unit Video Memory ROP Unit 3D Primitives Textures Frame Buffer Bus (AGP) Texture Combiner Geometry Stage Vertex Shader Unit
2002: Pixel Shader GPU Rasterization Stage CPU System Memory Graphics Application 3D Primitives Textures Rasterizer Multi Texture Unit Video Memory ROP Unit 3D Primitives Textures Frame Buffer Bus (AGP, PCIe) Pixel Shader Unit Geometry Stage Vertex Shader Unit
Pixel Shader Unit Vertex Shader Unit Geometric Shader Unit Shader Model NVidia ProductsCodeYear 1.xGeforce 3NV Geforce 4NV Geforce FXNV Geforce 6NV Geforce 7G Geforce 8G Geometric shader was added in Shader Model 4.0 Shader Model ATI ProductsCodeYear 1.xRadeon 8500~9250R Radeon 9500, 9700, X300, X550, X600 R Radeon 9800, X700, X800, X850 R Radeon X1300, X1600, X1650, X1800 R Radeon HD 2400, HD 2600, HD 2900 R
CPU Graphics Application Graphics API Computer Graphics Software GPU Pixel Shader Unit Vertex Shader Unit Graphics Device Driver Vertex Program Pixel Program Bus Graphics Software Architecture Geometric Shader Unit Geometric Program
Graphics Applications 3D modeling software (3D Studio, Maya, etc.) CAD software (Solidedge, Solidworks, Pro/E, etc.) Medical and business visualization software Computer games Graphics API API: Application Programming Interface Low level API OpenGL Direct3D High level API Open Inventor VRML Java3D
Vertex and Pixel Program (Shader) Assembly Language HLSL (High Level Shading Language) Cg (C for Graphics) DirectX HLSL GLSL (OpenGL Shading Language)
Introduction to OpenGL OpenGL (Open Graphics Library) : API for 3D graphics rendering. Originally developed on SGI graphics workstation. Became an open standard in Limitations: No input functions. No text rendering functions. No window management functions. Features: Open standard. Hardware independent. Cross-platform (Unix, Mac OS, Linux, Microsoft Windows). Cross-language (Bindings for C, C++, Fortran, Ada, Java) Extensible through OpenGL extension mechanism
OpenGL versions 1.1 (July 1, 1992) Adds texture objects, texture and subtexture copying, vertex array. 1.2 (March 16, 1998) Adds 3D texture, separate specular color, imaging subsets. 1.3 (August 14, 2001) Adds compressed texture, cube map texture, multitexture, texture combiner function, multisample antialiasing. 1.4 (July 24, 2002) Adds depth texture and shadows, Fog coordinates, Point parameters. 1.5 (July 29, 2003) Adds buffer objects. 2.0 (September 7, 2004) Adds OpenGL shading language, multiple render targets, non-power-of- two texture, point sprites, two-sided stencil operation.
Useful websites: nehe.gamedev.net DLabs Apple ATI Dell IBM Intel Nvidia SGI Sun Microsystems OpenGL ARB (Architecture Review Board)
DirectX DirectDraw Direct3D DirectSound DirectMusic DirectInput DirectPlay (Deprecated) DirectShow (Deprecated) DirectX Graphics DirectX Audio History of DirectX and Direct3D DirectX was designed by Microsoft to be a hardware independent API for game and multimedia programming under Windows. DirectDraw2D graphics rendering Direct3D3D graphics rendering DirectSoundSound input, synthesizing and output DirectMusicMusic input, synthesizing and output DirectInputKeyboard, mouse and gaming devices (joysticks, gamepads) input DirectPlayMultiplayer gaming over local network and the Internet DirectShowPlayback of video and audio multimedia files
DirectX version history Windows 95 was released. But most games were still written for DOS. Microsoft needed a unified API for game programming under Windows DirectX 1.0 was released for Windows DirectX 6.0. Added support for Direct3D immediate mode DirectX 7.0. Added support for hardware transformation and lighting DirectX 8.0. Added support for shaders in assembly language DirectX 9.0. Added DirectX HLSL DirectX 10.0 for Windows Vista only. Introducing Shader Model 4.0.
OpenGL and Direct3D Comparison OpenGLDirect3D StandardOpenMicrosoft Proprietary PortabilitySupport Multiple platforms including Unix, Linux, Mac OS, Windows, etc. Only for Windows Programming Language Support C, C++, Fortran, Ada, Java, etc. C, C++, Visual Basic, C#, etc. Programming Interface Conventional header and library COM (Component Object Model) ExtensibilityOpenGL extension mechanics New COM interfaces