Under the Hood: 3D Pipeline. Motherboard & Chipset PCI Express x16.

Slides:



Advertisements
Similar presentations
16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
Advertisements

COMPUTER GRAPHICS SOFTWARE.
Virtual Realism TEXTURE MAPPING. The Quest for Visual Realism.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Graphics Pipeline.
RealityEngine Graphics Kurt Akeley Silicon Graphics Computer Systems.
3D Graphics Rendering and Terrain Modeling
CS-378: Game Technology Lecture #9: More Mapping Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
Lecture 6: 3D Rendering Pipeline (III) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology.
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
CS5500 Computer Graphics © Chun-Fa Chang, Spring 2007 CS5500 Computer Graphics April 19, 2007.
Computer Graphics Hardware Acceleration for Embedded Level Systems Brian Murray
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
IN4151 Introduction 3D graphics 1 Introduction 3D Computer Graphics part 1 Projective display Viewing pipeline Graphics hardware Image-based rendering.
X86 and 3D graphics. Quick Intro to 3D Graphics Glossary: –Vertex – point in 3D space –Triangle – 3 connected vertices –Object – list of triangles that.
Rasterization May 14, Triangles Only We will discuss the rasterization of triangles only. Why? –Polygon can be decomposed into triangles. –A triangle.
IN4151 Introduction 3D graphics 1 Introduction to 3D computer graphics part 2 Viewing pipeline Multi-processor implementation GPU architecture GPU algorithms.
Evolution of the Programmable Graphics Pipeline Patrick Cozzi University of Pennsylvania CIS Spring 2011.
The Graphics Pipeline CS2150 Anthony Jones. Introduction What is this lecture about? – The graphics pipeline as a whole – With examples from the video.
Game Engine Design ITCS 4010/5010 Spring 2006 Kalpathi Subramanian Department of Computer Science UNC Charlotte.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
Programmable Shading May 21, Motivation Recall what are done in the graphics pipeline: –Front End: Transformations (Modeling, Viewing, and Projection)
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Hidden Surface Removal
Under the Hood: 3D Pipeline. Motherboard & Chipset PCI Express x16.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
Basic Graphics Concepts Day One CSCI 440. Terminology object - the thing being modeled image - view of object(s) on the screen frame buffer - memory that.
GPU Programming Robert Hero Quick Overview (The Old Way) Graphics cards process Triangles Graphics cards process Triangles Quads.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
CS662 Computer Graphics Game Technologies Jim X. Chen, Ph.D. Computer Science Department George Mason University.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
Chapter III Rasterization
© David Kirk/NVIDIA and Wen-mei W. Hwu, ECE408, University of Illinois, Urbana-Champaign 1 Programming Massively Parallel Processors Lecture.
From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Background image by chromosphere.deviantart.com Fella in following slides by devart.deviantart.com DM2336 Programming hardware shaders Dioselin Gonzalez.
Lecture 13: Raster Graphics and Scan Conversion
2 3D Viewing Process  3D viewing process MC Model Space Model Transformation Model Transformation WC World Space Viewing Transformation Viewing Transformation.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
Graphics Pipeline Bringing it all together. Implementation The goal of computer graphics is to take the data out of computer memory and put it up on the.
GPU Architecture and Its Application
- Introduction - Graphics Pipeline
Programmable Pipelines
Graphics Processing Unit
Chapter 6 GPU, Shaders, and Shading Languages
From Turing Machine to Global Illumination
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Graphics Processing Unit
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
Lecture 13 Clipping & Scan Conversion
CS5500 Computer Graphics April 17, 2006 CS5500 Computer Graphics
CS5500 Computer Graphics April 24, 2006.
Presentation transcript:

Under the Hood: 3D Pipeline

Motherboard & Chipset PCI Express x16

Discrete 3D Graphics Architecture CPU North Bridge North Bridge 3D GFX Local Memory Local Memory System Memory System Memory South Bridge South Bridge Display Devices Graphics Sub-System AGP / PCI-E Frame Buffer Z-Buffer Texture Vertex…

Discrete Graphics Cards NVIDIA ATI

Integrated 3D Graphics (Unified Memory Architecture) CPU NB + 3D GFX NB + 3D GFX Local Memory Local Memory System Memory System Memory South Bridge South Bridge Display Devices Graphics Sub-System AGP / PCI-E Display Devices Optional Frame Buffer Z-Buffer Texture Vertex… Local Memory Local Memory

Example: Intel Core i7 (1 st Generation)

Example: Intel Core i7 (2 nd 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) ons/kirk/index.htm ons/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

Some different versions…

14 A Detailed 3D Graphics Pipeline

A Quick Review By default, graphic pipeline will do the following: 1)Take as input various per-vertex quantities (color, light source, eye point, texture coordinates, etc.) 2)Calculate a final color for each vertex using a basic lighting model (OpenGL uses Phong lighting) 3)For each pixel, linearly interpolate the three surrounding vertex colors to shade the pixel (OpenGL uses Gouraud shading) 4)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.Gouraud-shaded polygons. 2.Then came antialiasing. 3.Then came texture mapping. 4.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 Transform [MVP],[MV],[MV] -T Lighting [0,1] [0,1] Texgen Texture Matrixn Color SecondaryColor TexCoordn EdgeFlag Normal Vertex (object) TexCoordn EdgeFlag Vertex (eye) Vertex (clip) Front&Back Color Front&Back SecondaryColor

21 FrontFacing Color Coord Depth OpenGL Fixed Function Fragment Tex n TE n SumFog [0,1] Coord FrontFacing Color SecondaryColor TexCoord[n] zz e z (|z e |,f ) Depth

Programmable Shaders A concept made popular by Pixar’s RenderMan. First appeared in hardware: UNC PixelFlow –See SIGGRAPH papers by Molnar 1995 and Olano Made affordable by nVidia GeForce3 and XBox.

GL2 Vertex Processor Temporaries Vertex Shader Uniform Color SecondaryColor TexCoordn EdgeFlag Normal Vertex (object) TexCoordn EdgeFlag Vertex (eye) Vertex (clip) Front&Back Color Front&Back SecondaryColor

24 GL2 Fragment Processor TexCoord[n] FrontFacing zz e z (|z e |,f ) Coord FrontFacing Color Coord Color SecondaryColor Depth Temporaries Fragment Shader Uniform Texture

Rasterization

Triangles Only We will discuss the rasterization of triangles only. Why? –Polygon can be decomposed into triangles. –A triangle is always convex. –Results in algorithms that are more hardware friendly.

Being Hardware Friendly [Angel 5e] Section : –Intersect scan lines with polygon edges. –Sort the intersections, first by scan lines, then by order of x on each scan line. –It works for polygons in general, not just in triangles. –O(n log n) complexity  feasible in software implementation only (i.e., not hardware friendly)

Using Edge Equations Find the edge equations for P1-P2, P2-P3, P1-P3 For each pixel, test which sides of the edges it is at. Q: Do we need to test every pixel on the screen? P1 P2 P3 ege defined by Ax+By+c=0

Example P1 P2 P3 ege defined by Ax+By+C=0

Example Now we have P1-P3 defined by 2x+y-4=0 To test if a point (u,v) is inside the triangle, we calculate 2(u)+(v)-4. For example, (0,0) leads to 2(0)+(0)-4=-4 So the negative side is inside. Use P2 to decide which side is inside. Negate A,B,C if you prefer the positive side P1 P2 P3 Ax+By+C=0

Color and Z Now we know which pixels must be drawn. The next step is to find their colors and Z’s. Gouraud shading: linear interpolation of the vertex colors. Isn’t it straightforward? –Interpolate along the edges. (Y direction) –Then interpolate along the span. (X direction)

32 Attribute Derivation Color Interpolation (255, 0, 0) (0, 255, 0)(0, 0, 255) (255, 0, 0) (0, 0, 0) Red (0, 0, 0) (0, 255, 0) Green (0, 0, 255) (0, 0, 0) Blue

Interpolation in World Space vs Screen Space P1=(x1, y1, z1, c1); P2=(x2, y2, z2, c2); P3=(x3, y3, z3, c3) in world space If (x3, y3) = (1-t)(x1, y1) + t(x2, y2) then z3=(1-t)z1+t z2; c3=(1-t)c1+t c2 P1=(x1,y1,z1) P3=(x3,y3,z3) P2=(x2,y2,z2)

Interpolation in World Space vs Screen Space But, remember that we are interpolating on screen coordinates (x’, y’): P’2 P’1 P2 P1 P3 x’ y’

Let P’ 1 =(x’ 1, y’ 1 ); P’ 2 =(x’ 2, y’ 2 ) and P’ 3 =(x’ 3, y’ 3 )= (1-s)(x’ 1, y’ 1 ) + s(x’ 2, y’ 2 ) Does s=t? If not, should we compute z3 and c3 by s or t? Express s in t (or vice versa), we get something like: So, if we interpolate z on screen space, we get the z of some other point on the line This is OK for Z’s, but may be a problem for texture coordinates (topic of another lecture)

Interpolation OpenGL uses interpolation to find proper texels from specified texture coordinates

Perspectively Correct Interpolation The previous slide is not “perspectively correct” Consider the interpolation along the vertical (Y) direction. Should the checkers spaced equally? Use the s to t conversion shown earlier, then you get the perspectively correct interpolation.

Appendix

Derivation of s and t Two end points P 1 =(x 1, y 1, z 1 ) and P 2 =(x 2, y 2, z 2 ). Let P 3 =(1-t)P 1 +(t)P 2 After projection, P 1, P 2, P 3 are projected to (x’ 1, y’ 1 ), (x’ 2, y’ 2 ), (x’ 3, y’ 3 ) in screen coordinates. Let (x’ 3, y’ 3 )=(1-s)(x’ 1, y’ 1 ) + s(x’ 2, y’ 2 ).

(x’ 1, y’ 1 ), (x’ 2, y’ 2 ), (x’ 3, y’ 3 ) are obtained from P 1, P 2, P 3 by:

Since We have:

When P 3 is projected to the screen, we get (x’ 3, y’ 3 ) by dividing by w, so: But remember that (x’ 3, y’ 3 )=(1-s)(x’ 1, y’ 1 ) + s(x’ 2, y’ 2 ) Looking at x coordinate, we have

We may rewrite s in terms of t, w 1, w 2, x’ 1, and x’ 2. In fact, or conversely Surprisingly, x’ 1 and x’ 2 disappear.