Programmable Pipelines
Objectives
• Introduce programmable pipelines
• Vertex shaders
• Fragment shaders
• Introduce shading languages
• Needed to describe shaders
• RenderMan
2
Introduction
• Recent major advance in real time graphics is programmable pipeline
• First introduced by NVIDIA GForce 3
• Supported by high-end commodity cards
• NVIDIA, ATI, 3D Labs
• Software Support
• Direct X 8 , 9, 10
• OpenGL Extensions
• OpenGL Shading Language (GLSL)
• Cg
3
Background
• Two components
• Vertex programs (shaders)
• Fragment programs (shaders)
• Requires detailed understanding of two seemingly contradictory
apporachs
• OpenGL pipeline
• Real time
• RenderMan ideas
• offline
4
Black Box View
5
Geometry
Processor
Frame
Buffer
Fragment
Processor
CPU
vertices vertices fragments
Rasterizer
fragments
Geometric Calculations
• Geometric data: set of vertices + type
• Can come from program, evaluator, display list
• type: point, line, polygon
• Vertex data can be
• (x,y,z,w) coordinates of a vertex (glVertex)
• Normal vector
• Texture Coordinates
• RGBA color
• Other data: color indices, edge flags
• Additional user-defined data in GLSL
6
Per-Vertex Operations
• Vertex locations are transformed by the model-view matrix into eye
coordinates
• Normals must be transformed with the inverse transpose of the
model-view matrix so that v·n=v’ ·n’ in both spaces
• Assumes there is no scaling
• May have to use autonormalization
• Textures coordinates are generated if autotexture enabled and the
texture matrix is applied
7
Lighting Calculations
• Consider a per-vertex basis Phong model
• Phong model requires computation of r and v at every vertex
8
I =kd Id l · n + ks Is (v · r )α
+ ka Ia
Calculating the Reflection Term
angle of incidence = angle of reflection
cos θi = cos θr or r·n = l·n
r, n, and l are coplanar
r = αl + βn
normalize
1 = r·r = n·n = l·l
solving: r = 2(l · n)n-l
9
OpenGL Lighting
• Modified Phong model
• Halfway vector
• Global ambient term
• Specified in standard
• Supported by hardware
10
Halfway Vector
Blinn proposed replacing v·r by n·h where
h = (l+v)/|l + v|
(l+v)/2 is halfway between l and v
If n, l, and v are coplanar:
ψ = φ/2
Must then adjust exponent
so that (n·h)e’
≈ (r.v)e
11
Primitive Assembly
•Vertices are next assembled into objects
• Polygons
• Line Segements
• Points
•Transformation by projection matrix
•Clipping
• Against user defined planes
• View volume, x=±w, y=±w, z=±w
• Polygon clipping can create new vertices
•Perspective Division
•Viewport mapping
12
Rasterization
• Geometric entities are rasterized into fragments
• Each fragment corresponds to a point on an integer grid: a displayed
pixel
• Hence each fragment is a potential pixel
• Each fragment has
• A color
• Possibly a depth value
• Texture coordinates
13
Fragment Operations
• Texture generation
• Fog
• Antialiasing
• Scissoring
• Alpha test
• Blending
• Dithering
• Logical Operation
• Masking
14
Vertex Processor
• Takes in vertices
• Position attribute
• Possibly color
• OpenGL state
• Produces
• Position in clip coordinates
• Vertex color
15
Fragment Processor
• Takes in output of rasterizer (fragments)
• Vertex values have been interpolated over primitive by rasterizer
• Outputs a fragment
• Color
• Texture
• Fragments still go through fragment tests
• Hidden-surface removal
• alpha
16
Programmable Shaders
• Replace fixed function vertex and fragment processing by
programmable processors called shaders
• Can replace either or both
• If we use a programmable shader we must do all required functions
of the fixed function processor
17
Development
• RenderMan Shading Language
• Offline rendering
• Hardware Shading Languages
• UNC, Stanford
• NVIDIA
• OpenGL Vertex Program Extension
• OpenGL Shading Language
• Cg
• OpenGL
• Microsoft HLSL
18
RenderMan
• Developed by Pixar
• S. Upstill, The RenderMan Companion, Addison-Wesley, 1989.
• Model
19
Modeler Renderer
interface file (RIB)
Modeling vs Rendering
• Modeler outputs geometric model plus information for the renderer
• Specifications of camera
• Materials
• Lights
• May have different kinds of renderers
• Ray tracer
• Radiosity
• How do we specify a shader?
20
Shading Trees
•Shaders such as the Phong model can be written as
algebraic expressions
•But expressions can be described by trees
•Need now operators such as dot and cross products
and new data types such as matrices and vectors
•Environmental variables are part of state
21
I =kd Id l · n + ks Is (v · r )s
+ ka Ia
Reflection Vector
22
Phong Model
23

More Related Content

PDF
zkStudyClub: CirC and Compiling Programs to Circuits
PPT
Open Graphics Library
PPTX
Shaders and the black magic
PPT
Graphical Objects and Scene Graphs
PDF
Halide - 2
PPTX
OpenGL Shading Language
PPT
SIGGRAPH 2010 - Style and Gameplay in the Mirror's Edge
PPTX
Baiscs of OpenGL
zkStudyClub: CirC and Compiling Programs to Circuits
Open Graphics Library
Shaders and the black magic
Graphical Objects and Scene Graphs
Halide - 2
OpenGL Shading Language
SIGGRAPH 2010 - Style and Gameplay in the Mirror's Edge
Baiscs of OpenGL

What's hot (12)

PPTX
Face recognition system
PPT
Implementation
PPTX
Fyp presentation final
PPTX
What is OpenGL ?
PDF
Gpu implementation of satellite image filtering
PDF
Verilog full adder in dataflow & gate level modelling style.
PPTX
PDF
Edge detection-based post-processing in Warlords of Draenor
PDF
Probabilistic Accuracy Bounds @ Papers We Love SF
PPT
Information security Seminar #3
PDF
Extracting a Rails Engine to a separated application
PPT
NVIDIA OpenGL and Vulkan Support for 2017
Face recognition system
Implementation
Fyp presentation final
What is OpenGL ?
Gpu implementation of satellite image filtering
Verilog full adder in dataflow & gate level modelling style.
Edge detection-based post-processing in Warlords of Draenor
Probabilistic Accuracy Bounds @ Papers We Love SF
Information security Seminar #3
Extracting a Rails Engine to a separated application
NVIDIA OpenGL and Vulkan Support for 2017
Ad

Similar to Programmable Piplelines (20)

PPT
Hardware Shaders
PPT
CS 354 Programmable Shading
PDF
Hpg2011 papers kazakov
PDF
PPTX
Graphics pipelining
PDF
Open gl
PDF
The Explanation the Pipeline design strategy.pdf
PPTX
Penn graphics
PDF
iOS Visual F/X Using GLSL
PPTX
OpenGL basics
PDF
Rendering basics
PPT
NVIDIA OpenGL in 2016
PPTX
Cg shaders with Unity3D
PPT
Advanced Graphics Workshop - GFX2011
PDF
lectureAll-OpenGL-complete-Guide-Tutorial.pdf
PDF
Game Programming 12 - Shaders
PPTX
Getting started with open gl es 2
PPT
CS 354 GPU Architecture
Hardware Shaders
CS 354 Programmable Shading
Hpg2011 papers kazakov
Graphics pipelining
Open gl
The Explanation the Pipeline design strategy.pdf
Penn graphics
iOS Visual F/X Using GLSL
OpenGL basics
Rendering basics
NVIDIA OpenGL in 2016
Cg shaders with Unity3D
Advanced Graphics Workshop - GFX2011
lectureAll-OpenGL-complete-Guide-Tutorial.pdf
Game Programming 12 - Shaders
Getting started with open gl es 2
CS 354 GPU Architecture
Ad

More from Syed Zaid Irshad (20)

PDF
Data Structures & Algorithms - Spring 2025.pdf
PDF
Operating System.pdf
PDF
DBMS_Lab_Manual_&_Solution
PPTX
Data Structure and Algorithms.pptx
PPTX
Design and Analysis of Algorithms.pptx
PPTX
Professional Issues in Computing
PDF
Reduce course notes class xi
PDF
Reduce course notes class xii
PDF
Introduction to Database
PDF
C Language
PDF
Flowchart
PDF
Algorithm Pseudo
PDF
Computer Programming
PDF
ICS 2nd Year Book Introduction
PDF
Security, Copyright and the Law
PDF
Computer Architecture
PDF
Data Communication
PDF
Information Networks
PDF
Basic Concept of Information Technology
PDF
Introduction to ICS 1st Year Book
Data Structures & Algorithms - Spring 2025.pdf
Operating System.pdf
DBMS_Lab_Manual_&_Solution
Data Structure and Algorithms.pptx
Design and Analysis of Algorithms.pptx
Professional Issues in Computing
Reduce course notes class xi
Reduce course notes class xii
Introduction to Database
C Language
Flowchart
Algorithm Pseudo
Computer Programming
ICS 2nd Year Book Introduction
Security, Copyright and the Law
Computer Architecture
Data Communication
Information Networks
Basic Concept of Information Technology
Introduction to ICS 1st Year Book

Recently uploaded (20)

PPTX
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
PDF
Visual Aids for Exploratory Data Analysis.pdf
PPTX
introduction to high performance computing
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
PDF
ChapteR012372321DFGDSFGDFGDFSGDFGDFGDFGSDFGDFGFD
PDF
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PDF
Improvement effect of pyrolyzed agro-food biochar on the properties of.pdf
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PPTX
Amdahl’s law is explained in the above power point presentations
PPTX
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
PPTX
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
PDF
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
PPT
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
Visual Aids for Exploratory Data Analysis.pdf
introduction to high performance computing
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
ChapteR012372321DFGDSFGDFGDFSGDFGDFGDFGSDFGDFGFD
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
Improvement effect of pyrolyzed agro-food biochar on the properties of.pdf
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
Exploratory_Data_Analysis_Fundamentals.pdf
Amdahl’s law is explained in the above power point presentations
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF

Programmable Piplelines

  • 2. Objectives • Introduce programmable pipelines • Vertex shaders • Fragment shaders • Introduce shading languages • Needed to describe shaders • RenderMan 2
  • 3. Introduction • Recent major advance in real time graphics is programmable pipeline • First introduced by NVIDIA GForce 3 • Supported by high-end commodity cards • NVIDIA, ATI, 3D Labs • Software Support • Direct X 8 , 9, 10 • OpenGL Extensions • OpenGL Shading Language (GLSL) • Cg 3
  • 4. Background • Two components • Vertex programs (shaders) • Fragment programs (shaders) • Requires detailed understanding of two seemingly contradictory apporachs • OpenGL pipeline • Real time • RenderMan ideas • offline 4
  • 6. Geometric Calculations • Geometric data: set of vertices + type • Can come from program, evaluator, display list • type: point, line, polygon • Vertex data can be • (x,y,z,w) coordinates of a vertex (glVertex) • Normal vector • Texture Coordinates • RGBA color • Other data: color indices, edge flags • Additional user-defined data in GLSL 6
  • 7. Per-Vertex Operations • Vertex locations are transformed by the model-view matrix into eye coordinates • Normals must be transformed with the inverse transpose of the model-view matrix so that v·n=v’ ·n’ in both spaces • Assumes there is no scaling • May have to use autonormalization • Textures coordinates are generated if autotexture enabled and the texture matrix is applied 7
  • 8. Lighting Calculations • Consider a per-vertex basis Phong model • Phong model requires computation of r and v at every vertex 8 I =kd Id l · n + ks Is (v · r )α + ka Ia
  • 9. Calculating the Reflection Term angle of incidence = angle of reflection cos θi = cos θr or r·n = l·n r, n, and l are coplanar r = αl + βn normalize 1 = r·r = n·n = l·l solving: r = 2(l · n)n-l 9
  • 10. OpenGL Lighting • Modified Phong model • Halfway vector • Global ambient term • Specified in standard • Supported by hardware 10
  • 11. Halfway Vector Blinn proposed replacing v·r by n·h where h = (l+v)/|l + v| (l+v)/2 is halfway between l and v If n, l, and v are coplanar: ψ = φ/2 Must then adjust exponent so that (n·h)e’ ≈ (r.v)e 11
  • 12. Primitive Assembly •Vertices are next assembled into objects • Polygons • Line Segements • Points •Transformation by projection matrix •Clipping • Against user defined planes • View volume, x=±w, y=±w, z=±w • Polygon clipping can create new vertices •Perspective Division •Viewport mapping 12
  • 13. Rasterization • Geometric entities are rasterized into fragments • Each fragment corresponds to a point on an integer grid: a displayed pixel • Hence each fragment is a potential pixel • Each fragment has • A color • Possibly a depth value • Texture coordinates 13
  • 14. Fragment Operations • Texture generation • Fog • Antialiasing • Scissoring • Alpha test • Blending • Dithering • Logical Operation • Masking 14
  • 15. Vertex Processor • Takes in vertices • Position attribute • Possibly color • OpenGL state • Produces • Position in clip coordinates • Vertex color 15
  • 16. Fragment Processor • Takes in output of rasterizer (fragments) • Vertex values have been interpolated over primitive by rasterizer • Outputs a fragment • Color • Texture • Fragments still go through fragment tests • Hidden-surface removal • alpha 16
  • 17. Programmable Shaders • Replace fixed function vertex and fragment processing by programmable processors called shaders • Can replace either or both • If we use a programmable shader we must do all required functions of the fixed function processor 17
  • 18. Development • RenderMan Shading Language • Offline rendering • Hardware Shading Languages • UNC, Stanford • NVIDIA • OpenGL Vertex Program Extension • OpenGL Shading Language • Cg • OpenGL • Microsoft HLSL 18
  • 19. RenderMan • Developed by Pixar • S. Upstill, The RenderMan Companion, Addison-Wesley, 1989. • Model 19 Modeler Renderer interface file (RIB)
  • 20. Modeling vs Rendering • Modeler outputs geometric model plus information for the renderer • Specifications of camera • Materials • Lights • May have different kinds of renderers • Ray tracer • Radiosity • How do we specify a shader? 20
  • 21. Shading Trees •Shaders such as the Phong model can be written as algebraic expressions •But expressions can be described by trees •Need now operators such as dot and cross products and new data types such as matrices and vectors •Environmental variables are part of state 21 I =kd Id l · n + ks Is (v · r )s + ka Ia