The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels...

22
The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles, polygons)

Transcript of The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels...

Page 1: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

The Graphics Rendering Pipeline

3D SCENE Collection of 3D primitives

IMAGEArray of pixels

Primitives: Basic geometric structures (points, lines, triangles, polygons)

Page 2: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

3D Primitives

2D Primitives

PixelsGeometry Stage

Rasterization Stage

Vertex Processing Pixel (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

Page 3: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

Video Memory

Computer Graphics Hardware

CPU

SystemMemory

Frame Buffer

Video Controller

Video Display Device

Graphics Controller

Primitive Data

Texture Data

Motherboard

Graphics Card

Bus (PCI, AGP, PCI Express)

Graphics Hardware Architecture

Page 4: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

The frame buffer: Video memory that holds screen pixel values.Resolution: Number of horizontal and vertical pixels on the screen.

The Frame Buffer

00

h-1

w-1

(x, y)

x

y

Pixel value

Color value

Depth (Z) value

Stencil value

Frame Buffer

Stencil Buffer

Color Buffer

Depth (Z) buffer

Page 5: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

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.

Page 6: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

Evolution of Graphics Controller

• Pre 1995: 2D era

• 1995-1998: First generation of 3D accelerators

• 1999-2000: 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

Page 7: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

Graphics Controller

Rasterization Stage

1995-1998: First generation of 3D accelerators

CPU

System Memory

Graphics Application

Geometry Stage

2D Primitives

Textures

RasterizerTexture

Unit

Video Memory

ROPUnit

2D Primitives

TexturesFrameBuffer

Bus(PCI)

Page 8: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

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

Page 9: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

1999-2000: GPU (Graphics Processing Unit)

GPU

Rasterization Stage

CPU

System Memory

Graphics Application

3D Primitives

Textures

RasterizerMulti

TextureUnit

Video Memory

ROPUnit

3D Primitives

TexturesFrameBuffer

Bus(AGP)

TextureCombiner

Geometry Stage

Transformation And

Lighting Unit

Page 10: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

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:http://www.firingsquad.com/hardware/3dfxdemise/

Page 11: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

2001: Vertex Shader

GPU

Rasterization Stage

CPU

System Memory

Graphics Application

3D Primitives

Textures

RasterizerMulti

TextureUnit

Video Memory

ROPUnit

3D Primitives

TexturesFrameBuffer

Bus(AGP)

TextureCombiner

Geometry Stage

VertexShader

Unit

Page 12: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

2002: Pixel Shader

GPU

Rasterization Stage

CPU

System Memory

Graphics Application

3D Primitives

Textures

RasterizerMulti

TextureUnit

Video Memory

ROPUnit

3D Primitives

TexturesFrameBuffer

Bus(AGP,PCIe)

PixelShader

Unit

Geometry Stage

VertexShader

Unit

Page 13: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

PixelShader

Unit

VertexShader

Unit

GeometricShader

Unit

Shader Model

NVidia

Products Code Year

1.x Geforce 3 NV20 2001

Geforce 4 NV25 2002

2.0 Geforce FX NV30 2002

3.0 Geforce 6 NV40 2004

Geforce 7 G70 2005

4.0 Geforce 8 G80 2006

Geometric shader was added in Shader Model 4.0

Shader Model

ATI

Products Code Year

1.x Radeon 8500~9250 R200 2001

2.0 Radeon 9500, 9700, X300, X550, X600

R300 2002

Radeon 9800, X700, X800, X850

R420 2004

3.0 Radeon X1300, X1600, X1650, X1800

R520 2005

4.0 Radeon HD 2400, HD 2600, HD 2900

R600 2007

Page 14: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

CPU

Graphics Application

Graphics API

Computer Graphics Software

GPU

PixelShader

Unit

VertexShader

Unit

Graphics Device Driver

VertexProgram

PixelProgram

Bus

Graphics Software Architecture

GeometricShader

Unit

GeometricProgram

Page 15: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

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

Page 16: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

Vertex and Pixel Program (Shader) Assembly Language

HLSL (High Level Shading Language)Cg (C for Graphics)

DirectX HLSLGLSL (OpenGL Shading Language)

Page 17: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

Introduction to OpenGL

OpenGL (Open Graphics Library): API for 3D graphics rendering. Originally developed on SGI graphics workstation. Became an open standard in 1992.

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

Page 18: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

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.

Page 19: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

Useful websites:• www.opengl.org• nehe.gamedev.net• www.gamedev.net• www.nvidia.com• www.ati.com• www.anandtech.com• www.tomshardware.com

3DLabsAppleATIDellIBMIntelNvidiaSGISun Microsystems

OpenGL ARB (Architecture Review Board)

Page 20: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

DirectX

DirectDrawDirect3DDirectSoundDirectMusicDirectInputDirectPlay (Deprecated)DirectShow (Deprecated)

DirectX Graphics

DirectX Audio

History of DirectX and Direct3DDirectX was designed by Microsoft to be a hardware independent API for game and multimedia programming under Windows.

DirectDraw 2D graphics renderingDirect3D 3D graphics renderingDirectSound Sound input, synthesizing and outputDirectMusic Music input, synthesizing and outputDirectInput Keyboard, mouse and gaming devices (joysticks, gamepads) inputDirectPlay Multiplayer gaming over local network and the InternetDirectShow Playback of video and audio multimedia files

Page 21: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

DirectX version history

• 1995.8. Windows 95 was released. But most games were still written for DOS. Microsoft needed a unified API for game programming under Windows 95.

• 1995.9. DirectX 1.0 was released for Windows 95.

• 1998. DirectX 6.0. Added support for Direct3D immediate mode.

• 2000. DirectX 7.0. Added support for hardware transformation and lighting.

• 2001. DirectX 8.0. Added support for shaders in assembly language.

• 2003. DirectX 9.0. Added DirectX HLSL.

• 2007. DirectX 10.0 for Windows Vista only. Introducing Shader Model 4.0.

Page 22: The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,

OpenGL and Direct3D Comparison

OpenGL Direct3D

Standard Open Microsoft Proprietary

Portability Support 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)

Extensibility OpenGL extension mechanics

New COM interfaces