The Graphics Pipeline

Similar documents
The Graphics Pipeline

The Projection Matrix

Shader Programs. Lecture 30 Subsections 2.8.2, Robb T. Koether. Hampden-Sydney College. Wed, Nov 16, 2011

The Critical-Path Algorithm

The Projection Matrix

Magnification and Minification

Minimal Spanning Trees

Shading Triangles. Lecture 37. Robb T. Koether. Hampden-Sydney College. Mon, Nov 30, 2015

Recursive Sequences. Lecture 24 Section 5.6. Robb T. Koether. Hampden-Sydney College. Wed, Feb 27, 2013

Recursive Sequences. Lecture 24 Section 5.6. Robb T. Koether. Hampden-Sydney College. Wed, Feb 26, 2014

Applying Textures. Lecture 27. Robb T. Koether. Hampden-Sydney College. Fri, Nov 3, 2017

The Decreasing-Time Algorithm

Specular Reflection. Lecture 19. Robb T. Koether. Hampden-Sydney College. Wed, Oct 4, 2017

while Loops Lecture 13 Sections Robb T. Koether Wed, Sep 26, 2018 Hampden-Sydney College

Scope and Parameter Passing

Stack Applications. Lecture 27 Sections Robb T. Koether. Hampden-Sydney College. Wed, Mar 29, 2017

Density Curves Sections

Sampling Distribution Examples Sections 15.4, 15.5

Rotations and Translations

The Traveling Salesman Problem Brute Force Method

Scope and Parameter Passing

Street-Routing Problems

Pointers. Lecture 1 Sections Robb T. Koether. Hampden-Sydney College. Wed, Jan 14, 2015

Recursive Descent Parsers

The Traveling Salesman Problem Nearest-Neighbor Algorithm

Scheduling and Digraphs

The string Class. Lecture 21 Sections 2.9, 3.9, Robb T. Koether. Wed, Oct 17, Hampden-Sydney College

The Pairwise-Comparison Method

Boxplots. Lecture 17 Section Robb T. Koether. Hampden-Sydney College. Wed, Feb 10, 2010

Binary Tree Applications

CS475/CS675 - Computer Graphics. OpenGL Drawing

Boolean Expressions. Lecture 31 Sections 6.6, 6.7. Robb T. Koether. Hampden-Sydney College. Wed, Apr 8, 2015

XPath Lecture 34. Robb T. Koether. Hampden-Sydney College. Wed, Apr 11, 2012

Abstract Data Types. Lecture 23 Section 7.1. Robb T. Koether. Hampden-Sydney College. Wed, Oct 24, 2012

Implementing Linked Lists

XML Attributes. Lecture 33. Robb T. Koether. Hampden-Sydney College. Wed, Apr 25, 2018

Building the Abstract Syntax Trees

Solving Recursive Sequences by Iteration

LR Parsing - Conflicts

Programming Languages

Graphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University

XPath. Lecture 36. Robb T. Koether. Wed, Apr 16, Hampden-Sydney College. Robb T. Koether (Hampden-Sydney College) XPath Wed, Apr 16, / 28

The Model Stack. Lecture 8. Robb T. Koether. Hampden-Sydney College. Wed, Sep 6, 2017

Pointer Arithmetic. Lecture 4 Chapter 10. Robb T. Koether. Hampden-Sydney College. Wed, Jan 25, 2017

Ambient and Diffuse Light

Mipmaps. Lecture 35. Robb T. Koether. Hampden-Sydney College. Wed, Nov 18, 2015

Programming with OpenGL Part 3: Shaders. Ed Angel Professor of Emeritus of Computer Science University of New Mexico

The Plurality-with-Elimination Method

CS 432 Interactive Computer Graphics

The Class Construct Part 1

Function Definition Syntax Tree

The Traveling Salesman Problem Cheapest-Link Algorithm

Lecture 2. Shaders, GLSL and GPGPU

Linked Lists. Lecture 16 Sections Robb T. Koether. Hampden-Sydney College. Wed, Feb 22, 2017

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Regular Expressions. Lecture 10 Sections Robb T. Koether. Hampden-Sydney College. Wed, Sep 14, 2016

OUTLINE. Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system

The Coefficient of Determination

2D graphics with WebGL

Programming Languages

Introduction to Compiler Design

Displaying Distributions - Quantitative Variables

Stack Applications. Lecture 25 Sections Robb T. Koether. Hampden-Sydney College. Mon, Mar 30, 2015

Nondeterministic Programming in C++

Recursion. Lecture 2 Sections Robb T. Koether. Hampden-Sydney College. Wed, Jan 17, 2018

Programmable GPUs. Real Time Graphics 11/13/2013. Nalu 2004 (NVIDIA Corporation) GeForce 6. Virtua Fighter 1995 (SEGA Corporation) NV1

Recursive Linked Lists

Today s Agenda. Basic design of a graphics system. Introduction to OpenGL

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

WebGL and GLSL Basics. CS559 Fall 2015 Lecture 10 October 6, 2015

Aggregation. Lecture 7 Section Robb T. Koether. Hampden-Sydney College. Wed, Jan 29, 2014

Copyright Khronos Group 2012 Page 1. Teaching GL. Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012

XQuery FLOWR Expressions Lecture 35

Operators. Lecture 12 Section Robb T. Koether. Hampden-Sydney College. Fri, Feb 9, 2018

PHP Queries and HTML Forms Lecture 23

Shader Programming. Daniel Wesslén, Stefan Seipel, Examples

The Mesh Class. Lecture 23. Robb T. Koether. Hampden-Sydney College. Wed, Oct 18, 2017

List Iterators. Lecture 27 Section Robb T. Koether. Hampden-Sydney College. Wed, Apr 8, 2015

Converts geometric primitives into images Is split into several independent stages Those are usually executed concurrently

List Iterator Implementation

OPENGL RENDERING PIPELINE

Practical Texturing (WebGL) CS559 Fall 2016 Lecture 20 November 7th 2016

The CYK Parsing Algorithm

The Normal Distribution

Today. Rendering - III. Outline. Texturing: The 10,000m View. Texture Coordinates. Specifying Texture Coordinates in GL

Stacks and their Applications

Recursion. Lecture 26 Sections , Robb T. Koether. Hampden-Sydney College. Mon, Apr 6, 2015

Friends and Unary Operators

The Constructors. Lecture 7 Sections Robb T. Koether. Hampden-Sydney College. Wed, Feb 1, 2017

Introduction to Computer Graphics with WebGL

WebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October

Webpage Navigation. Lecture 27. Robb T. Koether. Hampden-Sydney College. Mon, Apr 2, 2018

Models and Architectures

List Iterators. Lecture 34 Section Robb T. Koether. Hampden-Sydney College. Wed, Apr 24, 2013

Rendering Objects. Need to transform all geometry then

Array Lists. Lecture 15. Robb T. Koether. Hampden-Sydney College. Fri, Feb 16, 2018

Function Usage. Lecture 15 Sections 6.3, 6.4. Robb T. Koether. Hampden-Sydney College. Mon, Oct 1, 2018

CS GPU and GPGPU Programming Lecture 2: Introduction; GPU Architecture 1. Markus Hadwiger, KAUST

CS4620/5620: Lecture 14 Pipeline

E.Order of Operations

Transcription:

The Graphics Pipeline Lecture 2 Robb T. Koether Hampden-Sydney College Wed, Aug 23, 2017 Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 1 / 19

Outline 1 Vertices 2 The Graphics Pipeline 3 The Vertex Shader 4 The Fragment Shader 5 Assignment Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 2 / 19

Outline 1 Vertices 2 The Graphics Pipeline 3 The Vertex Shader 4 The Fragment Shader 5 Assignment Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 3 / 19

Vertices Objects consist basically of a set of vertices that define points in the plane (2D) or in space (3D). The vertices are grouped to create triangles, rectangles, and more complex surfaces. For example, a box might consist of 6 rectangles, each having 4 vertices. Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 4 / 19

Vertices Vertices are described by specifying their attributes. Position Color Normal vector (orientation) Texture coordinates These attributes are fed into the graphics pipeline. Each stage of the pipeline performs an operation on the object. Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 5 / 19

Outline 1 Vertices 2 The Graphics Pipeline 3 The Vertex Shader 4 The Fragment Shader 5 Assignment Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 6 / 19

Stages of the Pipeline The stages of the pipeline: Vertex shader Tessellation shader Geometry shader Primitive assembly Clipping Rasterization Fragment shader Per-fragment processing Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 7 / 19

Shaders The programmer is responsible for the shaders Vertex shader (mandatory) Tessellation shader (optional) Geometry shader (optional) Fragment shader (mandatory) The other stages are fixed. The programmer has no control over them. Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 8 / 19

The Graphics Pipeline Vertex Data Vertex Shader Tessellation Shader Geometry Shader Fragment Shader Rasterization Clipping Primitive Assembly Depth Testing Display Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 9 / 19

Outline 1 Vertices 2 The Graphics Pipeline 3 The Vertex Shader 4 The Fragment Shader 5 Assignment Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 10 / 19

The Vertex Shader At a minimum, the vertex shader assigns a value to the built-in shader variable gl_position. If that is all that the shader does, then it is called a pass-through shader. Vertex shaders typically do much more than that. Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 11 / 19

A Pass-Through Vertex Shader A Pass-Through Vertex Shader #version 450 core layout (location = 0) in vec3 vposition; void main() { gl_position = vec4(vposition, 1.0f); } Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 12 / 19

A Pass-Through Vertex Shader A Pass-Through Vertex Shader (with Color) #version 450 core layout (location = 0) in vec3 vposition; layout (location = 1) in vec3 vcolor; out vec4 color; void main() { gl_position = vec4(vposition, 1.0f); color = vec4(vcolor, 1.0f); } Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 13 / 19

Outline 1 Vertices 2 The Graphics Pipeline 3 The Vertex Shader 4 The Fragment Shader 5 Assignment Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 14 / 19

The Fragment Shader A fragment is typically a pixel, although it may be a part of a pixel. At a minimum, the fragment shader outputs the color of the pixel. The name of the output variable does not matter because all fragment shaders output only the color. A pass-through shader receives the color from the fragment shader and outputs it unchanged. Fragment shaders typically do much more than that. Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 15 / 19

A Pass-Through Fragment Shader A Pass-Through Fragment Shader (with Fixed Color) #version 450 core out vec4 fragcolor; void main() { fragcolor = vec4(1.0f, 0.0f, 0.0f, 1.0f); } Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 16 / 19

A Pass-Through Fragment Shader A Pass-Through Fragment Shader (with Color Input) #version 450 core in vec4 color; out vec4 fragcolor; void main() { fragcolor = color; } Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 17 / 19

Outline 1 Vertices 2 The Graphics Pipeline 3 The Vertex Shader 4 The Fragment Shader 5 Assignment Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 18 / 19

Assignment Assignment Assignment 2 Read pp. 10-14 in The Red Book. Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 19 / 19