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

Magnification and Minification

The Projection Matrix

The Critical-Path Algorithm

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

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

The Traveling Salesman Problem Brute Force Method

Minimal Spanning Trees

The Traveling Salesman Problem Nearest-Neighbor Algorithm

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

Scope and Parameter Passing

LR Parsing - Conflicts

Programming Languages

The Class Construct Part 1

The Plurality-with-Elimination Method

Scope and Parameter Passing

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

Scheduling and Digraphs

The Decreasing-Time Algorithm

The Pairwise-Comparison Method

CS475/CS675 - Computer Graphics. OpenGL Drawing

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

Density Curves Sections

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

Recursive Linked Lists

Sampling Distribution Examples Sections 15.4, 15.5

Solving Recursive Sequences by Iteration

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

Rotations and Translations

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

XQuery FLOWR Expressions Lecture 35

Street-Routing Problems

Friends and Unary Operators

List Iterator Implementation

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

Ambient and Diffuse Light

CS 432 Interactive Computer Graphics

Stacks and their Applications

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

Lecture 2. Shaders, GLSL and GPGPU

Recursive Descent Parsers

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

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

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

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

Pointers. Lecture 2 Sections Robb T. Koether. Hampden-Sydney College. Fri, Jan 18, 2013

Binary Tree Applications

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

2D graphics with WebGL

Programming Languages

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

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

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

Implementing Linked Lists

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

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

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

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

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

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

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

Building the Abstract Syntax Trees

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

The CYK Parsing Algorithm

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

Dynamic Allocation of Memory

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

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

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

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

OPENGL RENDERING PIPELINE

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

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

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

Function Definition Syntax Tree

WebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October

Introduction to Computer Graphics with WebGL

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

Models and Architectures

Rendering Objects. Need to transform all geometry then

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

CS4620/5620: Lecture 14 Pipeline

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

E.Order of Operations

Introduction to Shaders.

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)!

Total Orders. Lecture 41 Section 8.5. Robb T. Koether. Hampden-Sydney College. Mon, Apr 8, 2013

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

Shadows. Prof. George Wolberg Dept. of Computer Science City College of New York

Programming shaders & GPUs Christian Miller CS Fall 2011

CS452/552; EE465/505. Clipping & Scan Conversion

Real - Time Rendering. Graphics pipeline. Michal Červeňanský Juraj Starinský

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

The Traveling Salesman Problem Cheapest-Link Algorithm

Lecture 5 Vertex and Fragment Shaders-1. CITS3003 Graphics & Animation

Introduction to Compiler Design

The Coefficient of Determination

Transcription:

The Graphics Pipeline Lecture 2 Robb T. Koether Hampden-Sydney College Fri, Aug 28, 2015 Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Fri, Aug 28, 2015 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 Fri, Aug 28, 2015 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 Fri, Aug 28, 2015 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 Fri, Aug 28, 2015 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 Fri, Aug 28, 2015 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 Fri, Aug 28, 2015 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 Fri, Aug 28, 2015 7 / 19

Shaders The programmer is responsible for the shaders Vertex shader Tessellation shader Geometry shader Fragment shader The vertex shader and the fragment shader are mandatory. The tessellation shader and the geometry shader are optional. Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Fri, Aug 28, 2015 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 Fri, Aug 28, 2015 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 Fri, Aug 28, 2015 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 Fri, Aug 28, 2015 11 / 19

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

A Pass-Through Vertex Shader A Pass-Through Vertex Shader (with Color) #version 330 core layout (location = 0) in vec3 vposition; layout (location = 1) in vec3 vcolor; out vec4 color; void main() { gl_position = vposition; color = vec4(vcolor, 1.0f); } Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Fri, Aug 28, 2015 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 Fri, Aug 28, 2015 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. If that is all that the shader does, then it is called a pass-through shader. Fragment shaders typically do much more than that. Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Fri, Aug 28, 2015 15 / 19

A Pass-Through Fragment Shader A Pass-Through Fragment Shader (without Color Input) #version 330 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 Fri, Aug 28, 2015 16 / 19

A Pass-Through Fragment Shader A Pass-Through Fragment Shader (with Color Input) #version 330 core in vec4 color; out vec4 fragcolor; void main() { fragcolor = color; } Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Fri, Aug 28, 2015 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 Fri, Aug 28, 2015 18 / 19

Assignment Assignment Read pp. 10-14 in The Red Book. Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Fri, Aug 28, 2015 19 / 19