3D Pipeline

advertisement
Under the Hood: 3D Pipeline
Motherboard & Chipset
PCI Express x16
Graphics
Sub-System
Discrete 3D Graphics
Architecture
CPU
Local
Memory
North
Bridge
3D GFX
AGP / PCI-E
Frame Buffer
Z-Buffer
Texture
Vertex…
Display
Devices
South
Bridge
System
Memory
Discrete Graphics Cards
• NVIDIA
• ATI
Integrated 3D Graphics
(Unified Memory Architecture)
Graphics
Sub-System
Optional
Local
Memory
Local
Memory
3D GFX
AGP / PCI-E
Display
Devices
Display
Devices
CPU
NB +
3D GFX
System
Memory
South
Bridge
Frame Buffer
Z-Buffer
Texture
Vertex…
Example: Intel Core i7
(1st Generation)
Example: Intel Core i7
(2nd Generation)
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/presentati
ons/kirk/index.htm
Simplified View
Transform
(& Lighting)
Rasterization
• The Data Flow:
3D Polygons (+Colors, Lights, Normals,
Texture Coordinates…etc.)
2D Polygons
2D Pixels (I.e., Output Images)
Some different versions…
OpenGL ES 1.X
(Fixed Function Pipeline)
14
Conventional 3D Graphics Pipeline
Evolution of 3D Graphics Hardware
Triangles
Triangles
Surface Engine
Transform &
Lighting
Transform &
Lighting
Vertex Shader
Triangle Setup
Triangle Setup
Pixel Shader
Rasterization
Rasterization
Rasterization
Rasterization
Rasterization
Texture Mapping
Texture Mapping
Texture Mapping
Texture Mapping
Rendering
Rendering
Rendering
Rendering
Rendering
15
And some really scary ones…
A Detailed 3D Graphics Pipeline
17
A Quick Review
By default, graphic pipeline will do the
following:
1)
2)
3)
4)
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
1.
2.
3.
4.
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
OpenGL
Fixed Function Vertex
Vertex (object)
Normal
Vertex (clip)
Transform
[MVP],[MV],[MV]-T
Color
SecondaryColor
Vertex (eye)
Lighting
[0,1]
[0,1]
TexCoordn
EdgeFlag
Texgen
Texture
Matrixn
Front&Back
Color
Front&Back
SecondaryColor
TexCoordn
EdgeFlag
OpenGL
Fixed Function Fragment
Color
SecondaryColor
TexCoord[n]
Tex
n
TE
n
Sum
[0,1]
Fog
Color
z (|ze|,f )
Depth
Depth
Coord
Coord
FrontFacing
FrontFacing
24
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)
Uniform
Vertex (clip)
Normal
Vertex (eye)
Color
SecondaryColor
Front&Back
Color
TexCoordn
EdgeFlag
Vertex
Shader
Temporaries
Front&Back
SecondaryColor
TexCoordn
EdgeFlag
GL2 Fragment Processor
Color
SecondaryColor
TexCoord[n]
z (|ze|,f )
Uniform
Texture
Fragment
Shader
Depth
Coord
FrontFacing
Color
Depth
Temporaries
Coord
FrontFacing
27
Download