Shader Programs. Lecture 30 Subsections 2.8.2, Robb T. Koether. Hampden-Sydney College. Wed, Nov 16, 2011
|
|
- Madeline Hensley
- 5 years ago
- Views:
Transcription
1 Shader Programs Lecture 30 Subsections 2.8.2, Robb T. Koether Hampden-Sydney College Wed, Nov 16, 2011 Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
2 Outline 1 The Fixed Graphics Pipeline Vertex Shaders Fragment Shaders 2 The GLSL Language GLSL Data Types GLSL Variables Examples 3 Assignment Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
3 Outline 1 The Fixed Graphics Pipeline Vertex Shaders Fragment Shaders 2 The GLSL Language GLSL Data Types GLSL Variables Examples 3 Assignment Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
4 The Fixed Graphics Pipeline The fixed graphics pipeline. Process vertices. Assemble primitives. Transform vertices to clip coordinates. Clip primitives. Perform perspective division. Rasterize primitives. Process fragments. Write fragments to the framebuffer. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
5 The Fixed Graphics Pipeline The fixed graphics pipeline. Process vertices. Assemble primitives. Transform vertices to clip coordinates. Clip primitives. Perform perspective division. Rasterize primitives. Process fragments. Write fragments to the framebuffer. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
6 The Fixed Graphics Pipeline The fixed graphics pipeline vertex processor Transforms the vertex to eye coordinates. Transforms the normal to eye coordinates. Generates texture coordinates. Applies color material. Performs lighting calculations. Transforms the vertex to clip coordinates. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
7 The Fixed Graphics Pipeline The fixed graphics pipeline fragment processor Applies the interpolated shade. Applies the interpolated textures. Does a few other things (e.g., fog) that we haven t talked about. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
8 Outline 1 The Fixed Graphics Pipeline Vertex Shaders Fragment Shaders 2 The GLSL Language GLSL Data Types GLSL Variables Examples 3 Assignment Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
9 Vertex Shaders Definition (Vertex Shader) A vertex shader is a program that performs its own calculations on each vertex instead of using the calculations of the fixed pipeline. It is mandatory that the vertex shader compute the clip coordinates of the vertex. All other calculations (lighting, textures, etc.) are optional. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
10 Vertex Shaders Example (A Minimal Vertex Shader) void main() { gl_position = gl_modelviewprojectionmatrix * gl_vertex; } Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
11 Vertex Shaders Example (A Minimal Vertex Shader) void main() { gl_position = ftransform(); } The ftransform() function will do the same thing. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
12 Outline 1 The Fixed Graphics Pipeline Vertex Shaders Fragment Shaders 2 The GLSL Language GLSL Data Types GLSL Variables Examples 3 Assignment Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
13 Fragment Shaders Definition (Fragment Shader) A fragment shader is a program that performs its own calculations on each fragment of a primitive instead of using the interpolated values of the fixed pipeline. It is mandatory that the fragment shader compute the color of the fragment. All other calculations are optional. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
14 Fragment Shaders Example (A Minimal Fragment Shader) void main() { gl_fragcolor = gl_color; } Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
15 Minimal Shaders Lecture 30 Demo 1 This demo consists of three programs: Lecture 30 Demo 1.vert Lecture 30 Demo 1.frag Lecture 30 Demo 1.cpp The shader programs are minimal shaders. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
16 Outline 1 The Fixed Graphics Pipeline Vertex Shaders Fragment Shaders 2 The GLSL Language GLSL Data Types GLSL Variables Examples 3 Assignment Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
17 Outline 1 The Fixed Graphics Pipeline Vertex Shaders Fragment Shaders 2 The GLSL Language GLSL Data Types GLSL Variables Examples 3 Assignment Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
18 GLSL Data Types GLSL is the OpenGL Shading Language. GLSL provides several variable types. Shader variables must be of these types. The three primitive types are bool int float Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
19 GLSL Data Types GLSL has several vector types Boolean vectors - bvec2, bvec3, bvec4. Integer vectors - ivec2, ivec3, ivec4. Floating-point vectors - vec2, vec3, vec4. GLSL has three floating-point matrix types 2 2 matrices - mat matrices - mat matrices - mat4. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
20 GLSL Data Types Example (GLSL Data Types) // Vertex Shader void main() { gl_position = ftransform(); gl_frontcolor = vec4(1.0, 0.0, 1.0, 1.0); } // Fragment Shader void main() { gl_fragcolor = gl_color; } Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
21 Outline 1 The Fixed Graphics Pipeline Vertex Shaders Fragment Shaders 2 The GLSL Language GLSL Data Types GLSL Variables Examples 3 Assignment Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
22 GLSL Variables There are four categories of variable. const uniform attribute varying Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
23 GLSL Variables Definition (const Variable) A const variable is constant at compile time and, therefore, constant throughout the program. A const is defined within a shader and its scope is limited to that shader. Application Vertex Shader const int s = 0; Fragment Shader const int t = 1; Framebuffer Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
24 GLSL Variables Definition (uniform Variable) A uniform variable may be modified by the application program, but its value is constant over the scope of a primitive, i.e., throughout a glbegin()/glend() pair. A uniform variable holds a value that is associated with the primitive. Vertex Shader uniform int s; Application s gluniform(sloc, s); gluniform(tloc, t); t Fragment Shader uniform int t; Framebuffer Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
25 GLSL Variables Definition (attribute Variable) An attribute variable may be modified for each vertex, but its value is constant during the processing of that vertex. An attribute variable holds a value that is associated with the vertex. Vertex Shader attribute int s; Application s glvertexattrib(sloc, s); Fragment Shader Framebuffer Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
26 GLSL Variables Definition (varying Variable) A varying variable is given a value by the vertex shader. Its values at the vertices are interpolated over the primitive. A varying variable holds a value that will be sent to the fragment shader. Application Vertex Shader varying float s; s Fragment Shader varying float s; Framebuffer Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
27 Outline 1 The Fixed Graphics Pipeline Vertex Shaders Fragment Shaders 2 The GLSL Language GLSL Data Types GLSL Variables Examples 3 Assignment Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
28 GLSL Data Types Example (Constants) const vec4 blue = vec4(0.0, 0.0, 1.0, 1.0); void main() { gl_position = ftransform(); gl_frontcolor = blue; } Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
29 Constants Lecture 30 Demo 2 This vertex shader program uses a constant to set the color to blue. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
30 GLSL Data Types Example (Uniform Variables) const vec4 blue = vec4(0.0, 0.0, 1.0, 1.0); uniform float s; void main() { gl_position = ftransform(); gl_frontcolor = mix(gl_color, blue, s); } Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
31 Uniform Variables For uniform variables, it is necessary to establish a means of communicating their values from the application to the shader programs. In the application program, use glgetuniformlocation() to receive a storage location for the variable in the GPU (once and for all). Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
32 Uniform Variables glgetuniformlocation() unsigned int glgetuniformlocation(unsigned int progobj, string var_name); progobj The program reference number (to be discussed later). var_name The name of the variable in the shader. Return value A reference number for the location of the variable in the GPU. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
33 Uniform Variables Then it is necessary to pass the current value from the application program to the GPU. Use gluniform() to do this (as often as the value changes). Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
34 Uniform Variables gluniform() void gluniform(unsigned int loc, type value); loc The reference number returned by glgetuniformlocation(). value The value to be passed to the shader. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
35 Uniform Variables Example (Uniform Variables) // In the application float time; unsigned int tloc = glgetuniformlocation(myprog, "t"); gluniform1f(tloc, time); // In the vertex shader uniform float t; void main() { gl_frontcolor = mix(red, blue, sin(t)); }. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
36 Uniform Variables Lecture 30 Demo 3 This vertex shader program uses a uniform variable to change the color. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
37 GLSL Variables Example (Varying Variables) // In the vertex shader varying vec3 vertex_color; void main() { vertex_color = gl_normal; }. // In the fragment shader varying vec3 vertex_color; void main() { gl_fragcolor = vertex_color; }. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
38 Varying Variables Lecture 30 Demo 4 These shader programs use a varying variable to change the color. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
39 Attribute Variables Attribute variables may be given a different value for each vertex in a primitive. Otherwise, they are handled much like uniform variables. For attribute variables, it is necessary to establish a means of communicating their values from the application to the shader programs. In the application program, use glgetattriblocation() to receive a storage location for the variable in the GPU (once and for all). Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
40 Attribute Variables glgetuniformlocation() int glgetattriblocation(unsigned int progobj, string var_name); progobj The program reference number (to be discussed on Friday). var_name The name of the variable in the shader. Return value A reference number for the location of the variable in the GPU. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
41 Attribute Variables Then it is necessary to pass the current value from the application program to the GPU. Use glvertexattrib() to do this (as often as the value changes). Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
42 Attribute Variables glvertexattrib() void glvertexattrib(unsigned int loc, type value); loc The reference number returned by glgetattriblocation(). value The value to be passed to the shader. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
43 GLSL Variables Example (Attribute Variables) // In the vertex shader attribute vec3 color; void main() { gl_frontcolor = mix(gl_color, color, 0.5); }. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
44 Attribute Variables Lecture 30 Demo 5 This vertex shader program uses an attribute variable to change the color of the upper vertex of each vertex in a triangle strip. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
45 Outline 1 The Fixed Graphics Pipeline Vertex Shaders Fragment Shaders 2 The GLSL Language GLSL Data Types GLSL Variables Examples 3 Assignment Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
46 Homework Homework Read Subsection The vertex shader. Read Subsection The fragment shader. Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, / 43
The Graphics Pipeline
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
More informationThe Graphics Pipeline
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
More informationProgramming shaders & GPUs Christian Miller CS Fall 2011
Programming shaders & GPUs Christian Miller CS 354 - Fall 2011 Fixed-function vs. programmable Up until 2001, graphics cards implemented the whole pipeline for you Fixed functionality but configurable
More informationThe Projection Matrix
The Projection Matrix Lecture 5 Robb T. Koether Hampden-Sydney College Wed, Aug 30, 2017 Robb T. Koether (Hampden-Sydney College) The Projection Matrix Wed, Aug 30, 2017 1 / 21 Outline 1 The World Coordinate
More informationShader Programming. Daniel Wesslén, Stefan Seipel, Examples
Shader Programming Daniel Wesslén, dwn@hig.se Stefan Seipel, ssl@hig.se Examples 1 Per-pixel lighting Texture convolution filtering 2 Post-processing, animated procedural textures Vertex displacement mapping
More informationProgramming with OpenGL Part 3: Shaders. Ed Angel Professor of Emeritus of Computer Science University of New Mexico
Programming with OpenGL Part 3: Shaders Ed Angel Professor of Emeritus of Computer Science University of New Mexico 1 Objectives Simple Shaders - Vertex shader - Fragment shaders Programming shaders with
More informationSupplement to Lecture 22
Supplement to Lecture 22 Programmable GPUs Programmable Pipelines Introduce programmable pipelines - Vertex shaders - Fragment shaders Introduce shading languages - Needed to describe shaders - RenderMan
More informationShading Triangles. Lecture 37. Robb T. Koether. Hampden-Sydney College. Mon, Nov 30, 2015
Shading Triangles Lecture 37 Robb T. Koether Hampden-Sydney College Mon, Nov 30, 2015 Robb T. Koether (Hampden-Sydney College) Shading Triangles Mon, Nov 30, 2015 1 / 35 Outline 1 Shading Triangles Barycentric
More informationInformation Coding / Computer Graphics, ISY, LiTH GLSL. OpenGL Shading Language. Language with syntax similar to C
GLSL OpenGL Shading Language Language with syntax similar to C Syntax somewhere between C och C++ No classes. Straight ans simple code. Remarkably understandable and obvious! Avoids most of the bad things
More informationGLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people
GLSL Introduction Fu-Chung Huang Thanks for materials from many other people Shader Languages Currently 3 major shader languages Cg (Nvidia) HLSL (Microsoft) Derived from Cg GLSL (OpenGL) Main influences
More informationLecture 5 Vertex and Fragment Shaders-1. CITS3003 Graphics & Animation
Lecture 5 Vertex and Fragment Shaders-1 CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives The rendering pipeline and the shaders Data
More informationThe Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)!
! The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 4! stanford.edu/class/ee267/! Updates! for 24h lab access:
More informationThe Projection Matrix
The Projection Matrix Lecture 8 Robb T. Koether Hampden-Sydney College Fri, Sep 11, 2015 Robb T. Koether (Hampden-Sydney College) The Projection Matrix Fri, Sep 11, 2015 1 / 43 Outline 1 Coordinate Systems
More informationThe Transition from RenderMan to the OpenGL Shading Language (GLSL)
1 The Transition from RenderMan to the OpenGL Shading Language (GLSL) Mike Bailey mjb@cs.oregonstate.edu This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International
More informationProgrammable GPUs. Real Time Graphics 11/13/2013. Nalu 2004 (NVIDIA Corporation) GeForce 6. Virtua Fighter 1995 (SEGA Corporation) NV1
Programmable GPUs Real Time Graphics Virtua Fighter 1995 (SEGA Corporation) NV1 Dead or Alive 3 2001 (Tecmo Corporation) Xbox (NV2A) Nalu 2004 (NVIDIA Corporation) GeForce 6 Human Head 2006 (NVIDIA Corporation)
More informationSign up for crits! Announcments
Sign up for crits! Announcments Reading for Next Week FvD 16.1-16.3 local lighting models GL 5 lighting GL 9 (skim) texture mapping Modern Game Techniques CS248 Lecture Nov 13 Andrew Adams Overview The
More informationCSE 167: Introduction to Computer Graphics Lecture #13: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015
CSE 167: Introduction to Computer Graphics Lecture #13: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015 Announcements Project 6 due Friday Next Thursday: Midterm #2
More informationProgramming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico
Programming with OpenGL Shaders I Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico 0 Objectives Shader Basics Simple Shaders Vertex shader Fragment shaders 1 Vertex
More informationGLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people
GLSL Introduction Fu-Chung Huang Thanks for materials from many other people Programmable Shaders //per vertex inputs from main attribute aposition; attribute anormal; //outputs to frag. program varying
More informationProgrammable Graphics Hardware
CSCI 480 Computer Graphics Lecture 14 Programmable Graphics Hardware [Ch. 9] March 2, 2011 Jernej Barbic University of Southern California OpenGL Extensions Shading Languages Vertex Program Fragment Program
More informationThe Critical-Path Algorithm
The Critical-Path Algorithm Lecture 32 Sections 8.3-8.4 Robb T. Koether Hampden-Sydney College Wed, Nov 19, 2014 Robb T. Koether (Hampden-Sydney College) The Critical-Path Algorithm Wed, Nov 19, 2014 1
More informationLecture 09: Shaders (Part 1)
Lecture 09: Shaders (Part 1) CSE 40166 Computer Graphics Peter Bui University of Notre Dame, IN, USA November 9, 2010 OpenGL Rendering Pipeline OpenGL Rendering Pipeline (Pseudo-Code) 1 f o r gl_vertex
More informationCSE 167: Lecture #8: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012
CSE 167: Introduction to Computer Graphics Lecture #8: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Homework project #4 due Friday, November 2 nd Introduction:
More informationSome advantages come from the limited environment! No classes. Stranight ans simple code. Remarkably. Avoids most of the bad things with C/C++.
GLSL OpenGL Shading Language Language with syntax similar to C Syntax somewhere between C och C++ No classes. Stranight ans simple code. Remarkably understandable and obvious! Avoids most of the bad things
More informationIntroduction to Shaders.
Introduction to Shaders Marco Benvegnù hiforce@gmx.it www.benve.org Summer 2005 Overview Rendering pipeline Shaders concepts Shading Languages Shading Tools Effects showcase Setup of a Shader in OpenGL
More informationToday. Rendering - III. Outline. Texturing: The 10,000m View. Texture Coordinates. Specifying Texture Coordinates in GL
Today Rendering - III CS148, Summer 2010 Graphics Pipeline and Programmable Shaders Artist Workflow Siddhartha Chaudhuri 1 2 Outline Texturing: The 10,000m View Intro to textures The fixed-function graphics
More information12.2 Programmable Graphics Hardware
Fall 2018 CSCI 420: Computer Graphics 12.2 Programmable Graphics Hardware Kyle Morgenroth http://cs420.hao-li.com 1 Introduction Recent major advance in real time graphics is the programmable pipeline:
More informationProgramming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico
Programming with OpenGL Shaders I Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico Objectives Shader Programming Basics Simple Shaders Vertex shader Fragment shaders
More informationMagnification and Minification
Magnification and Minification Lecture 30 Robb T. Koether Hampden-Sydney College Fri, Nov 6, 2015 Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 1 / 17 Outline
More informationThe Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)!
! The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 4! stanford.edu/class/ee267/! Lecture Overview! Review
More informationProgrammable Graphics Hardware
Programmable Graphics Hardware Outline 2/ 49 A brief Introduction into Programmable Graphics Hardware Hardware Graphics Pipeline Shading Languages Tools GPGPU Resources Hardware Graphics Pipeline 3/ 49
More informationShader Programming 1. Examples. Vertex displacement mapping. Daniel Wesslén 1. Post-processing, animated procedural textures
Shader Programming 1 Examples Daniel Wesslén, dwn@hig.se Per-pixel lighting Texture convolution filtering Post-processing, animated procedural textures Vertex displacement mapping Daniel Wesslén 1 Fragment
More informationApplying Textures. Lecture 27. Robb T. Koether. Hampden-Sydney College. Fri, Nov 3, 2017
Applying Textures Lecture 27 Robb T. Koether Hampden-Sydney College Fri, Nov 3, 2017 Robb T. Koether (Hampden-Sydney College) Applying Textures Fri, Nov 3, 2017 1 / 24 Outline 1 Applying Textures 2 Photographs
More informationLecture 31 Sections 9.1, 9.2, 9.3. Mon, Nov 23, 2009
Lecture 31 Sections 9.1, 9.2, 9.3 Hampden-Sydney College Mon, Nov 23, 2009 Outline 1 2 3 4 5 Outline 1 2 3 4 5 The extension wrangler (glew) will check to see which extensions are supported by the installed
More informationShaders. Slide credit to Prof. Zwicker
Shaders Slide credit to Prof. Zwicker 2 Today Shader programming 3 Complete model Blinn model with several light sources i diffuse specular ambient How is this implemented on the graphics processor (GPU)?
More informationLecture 2. Shaders, GLSL and GPGPU
Lecture 2 Shaders, GLSL and GPGPU Is it interesting to do GPU computing with graphics APIs today? Lecture overview Why care about shaders for computing? Shaders for graphics GLSL Computing with shaders
More informationRecursive 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 27, 2013 Robb T. Koether (Hampden-Sydney College) Recursive Sequences Wed, Feb 27, 2013 1 / 21 1 Recursive Sequences
More informationOpenGL Programmable Shaders
h gpup 1 Topics Rendering Pipeline Shader Types OpenGL Programmable Shaders sh gpup 1 OpenGL Shader Language Basics h gpup 1 EE 4702-X Lecture Transparency. Formatted 9:03, 20 October 2014 from shaders2.
More information2D graphics with WebGL
2D graphics with WebGL Some material contained here is adapted from the book s slides. September 7, 2015 (Dr. Mihail) 2D graphics September 7, 2015 1 / 22 Graphics Pipeline (Dr. Mihail) 2D graphics September
More informationCSE 167: Introduction to Computer Graphics Lecture #7: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016
CSE 167: Introduction to Computer Graphics Lecture #7: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 Announcements Project 2 due Friday 4/22 at 2pm Midterm #1 on
More informationSHADER PROGRAMMING. Based on Jian Huang s lecture on Shader Programming
SHADER PROGRAMMING Based on Jian Huang s lecture on Shader Programming What OpenGL 15 years ago could do http://www.neilturner.me.uk/shots/opengl-big.jpg What OpenGL can do now What s Changed? 15 years
More informationIntroduction to the OpenGL Shading Language (GLSL)
1 Introduction to the OpenGL Shading Language (GLSL) This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International License Mike Bailey mjb@cs.oregonstate.edu
More informationWebGL and GLSL Basics. CS559 Fall 2015 Lecture 10 October 6, 2015
WebGL and GLSL Basics CS559 Fall 2015 Lecture 10 October 6, 2015 Last time Hardware Rasterization For each point: Compute barycentric coords Decide if in or out.7,.7, -.4 1.1, 0, -.1.9,.05,.05.33,.33,.33
More informationGLSL 1: Basics. J.Tumblin-Modified SLIDES from:
GLSL 1: Basics J.Tumblin-Modified SLIDES from: Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico and
More informationwhile Loops Lecture 13 Sections Robb T. Koether Wed, Sep 26, 2018 Hampden-Sydney College
while Loops Lecture 13 Sections 5.8-5.9 Robb T. Koether Hampden-Sydney College Wed, Sep 26, 2018 Robb T. Koether (Hampden-Sydney College) while Loops Wed, Sep 26, 2018 1 / 25 1 while Loops 2 Input Loops
More informationThe Basic Computer Graphics Pipeline, OpenGL-style. Introduction to the OpenGL Shading Language (GLSL)
Introduction to the OpenGL Shading Language (GLSL) 1 The Basic Pipeline, OpenGL-style Vertex, Normal, Color ModelViewMatrix, ProjectionMatrix, ModelViewProjectionMatrix 2 MC Model WC View Per-vertex Projection
More informationIntroduction to Shaders for Visualization. The Basic Computer Graphics Pipeline
Introduction to Shaders for Visualization Mike Bailey The Basic Computer Graphics Pipeline Model Transform View Transform Per-vertex Lighting Projection Transform Homogeneous Division Viewport Transform
More informationOPENGL RENDERING PIPELINE
CPSC 314 03 SHADERS, OPENGL, & JS UGRAD.CS.UBC.CA/~CS314 Textbook: Appendix A* (helpful, but different version of OpenGL) Alla Sheffer Sep 2016 OPENGL RENDERING PIPELINE 1 OPENGL RENDERING PIPELINE Javascript
More informationCS 432 Interactive Computer Graphics
CS 432 Interactive Computer Graphics Lecture 2 Part 2 Introduction to Shaders Matt Burlick - Drexel University - CS 432 1 Shaders To understand shaders, let s look at the graphics pipeline again The job
More informationShadows. Prof. George Wolberg Dept. of Computer Science City College of New York
Shadows Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Introduce Shadow Algorithms Expand to projective textures 2 Flashlight in the Eye Graphics When do we not see
More informationWebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October
WebGL and GLSL Basics CS559 Fall 2016 Lecture 14 October 24 2016 Review Hardware Rasterization For each point: Compute barycentric coords Decide if in or out.7,.7, -.4 1.1, 0, -.1.9,.05,.05.33,.33,.33
More informationShaders. Introduction. OpenGL Grows via Extensions. OpenGL Extensions. OpenGL 2.0 Added Shaders. Shaders Enable Many New Effects
CSCI 420 Computer Graphics Lecture 4 Shaders Jernej Barbic University of Southern California Shading Languages GLSL Vertex Array Objects Vertex Shader Fragment Shader [Angel Ch. 1, 2, A] Introduction The
More informationGLSL v1.20. Scott MacHaffie Schrödinger, Inc.
1 GLSL v1.20 Scott MacHaffie Schrödinger, Inc. http://www.schrodinger.com Table of Contents Introduction...2 Example 01: Trivial shader...2 Syntax...3 Types of variables...3 Example 02: Materials vertex
More informationIntroduction to the OpenGL Shading Language
Introduction to the OpenGL Shading Language Randi Rost Director of Developer Relations, 3Dlabs 08-Dec-2005 1 Why use graphics programmability? Graphics hardware has changed radically Fixed functionality
More informationRecursive Sequences. Lecture 24 Section 5.6. Robb T. Koether. Hampden-Sydney College. Wed, Feb 26, 2014
Recursive Sequences Lecture 24 Section 5.6 Robb T. Koether Hampden-Sydney College Wed, Feb 26, 2014 Robb T. Koether (Hampden-Sydney College) Recursive Sequences Wed, Feb 26, 2014 1 / 26 1 Recursive Sequences
More informationMinimal Spanning Trees
Minimal Spanning Trees Lecture 33 Sections 7.1-7.3 Robb T. Koether Hampden-Sydney College Wed, Apr 11, 20 Robb T. Koether (Hampden-Sydney College) Minimal Spanning Trees Wed, Apr 11, 20 1 / 17 1 Networks
More informationCMPS160 Shader-based OpenGL Programming. All slides originally from Prabath Gunawardane, et al. unless noted otherwise
CMPS160 Shader-based OpenGL Programming All slides originally from Prabath Gunawardane, et al. unless noted otherwise Shader gallery I Above: Demo of Microsoft s XNA game platform Right: Product demos
More informationSpecular Reflection. Lecture 19. Robb T. Koether. Hampden-Sydney College. Wed, Oct 4, 2017
Specular Reflection Lecture 19 Robb T. Koether Hampden-Sydney College Wed, Oct 4, 2017 Robb T. Koether (Hampden-Sydney College) Specular Reflection Wed, Oct 4, 2017 1 / 22 Outline 1 Specular Reflection
More informationObjectives. Open GL Shading Language (GLSL)
Open GL Shading Language (GLSL) Objectives Shader applications Vertex shaders Fragment shaders Programming shaders Cg GLSL Coupling GLSL to Applications Example applications 1 Vertex Shader Applications
More informationX. GPU Programming. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter X 1
X. GPU Programming 320491: Advanced Graphics - Chapter X 1 X.1 GPU Architecture 320491: Advanced Graphics - Chapter X 2 GPU Graphics Processing Unit Parallelized SIMD Architecture 112 processing cores
More informationComp 410/510 Computer Graphics Spring Programming with OpenGL Part 3: Shaders
Comp 410/510 Computer Graphics Spring 2018 Programming with OpenGL Part 3: Shaders Objectives Basic shaders - Vertex shader - Fragment shader Programming shaders with GLSL Finish first program void init(void)
More informationC P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev
C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE UGRAD.CS.UBC.C A/~CS314 Mikhail Bessmeltsev 1 WHAT IS RENDERING? Generating image from a 3D scene 2 WHAT IS RENDERING? Generating image
More informationMobile Application Programing: Android. OpenGL Operation
Mobile Application Programing: Android OpenGL Operation Activities Apps are composed of activities Activities are self-contained tasks made up of one screen-full of information Activities start one another
More informationGraphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University
Graphics Programming Computer Graphics, VT 2016 Lecture 2, Chapter 2 Fredrik Nysjö Centre for Image analysis Uppsala University Graphics programming Typically deals with How to define a 3D scene with a
More informationCOMP371 COMPUTER GRAPHICS
COMP371 COMPUTER GRAPHICS SESSION 12 PROGRAMMABLE SHADERS Announcement Programming Assignment #2 deadline next week: Session #7 Review of project proposals 2 Lecture Overview GPU programming 3 GPU Pipeline
More informationAn Overview GLUT GLSL GLEW
OpenGL, GLUT, GLEW, GLSL An Overview GLUT GLEW GLSL Objectives Give you an overview of the software that you will be using this semester OpenGL, GLUT, GLEW, GLSL What are they? How do you use them? What
More informationBoolean Expressions. Lecture 31 Sections 6.6, 6.7. Robb T. Koether. Hampden-Sydney College. Wed, Apr 8, 2015
Boolean Expressions Lecture 31 Sections 6.6, 6.7 Robb T. Koether Hampden-Sydney College Wed, Apr 8, 2015 Robb T. Koether (Hampden-Sydney College) Boolean Expressions Wed, Apr 8, 2015 1 / 22 1 Relational
More informationThe Model Stack. Lecture 8. Robb T. Koether. Hampden-Sydney College. Wed, Sep 6, 2017
The Model Stack Lecture 8 Robb T. Koether Hampden-Sydney College Wed, Sep 6, 2017 Robb T. Koether (Hampden-Sydney College) The Model Stack Wed, Sep 6, 2017 1 / 19 Outline 1 Drawing Rectangle Man 2 The
More informationThe OpenGL Shading Language
The OpenGL Shading Language GLSL In the previous lecture we looked at the process of loading shaders into the programmable hardware (GPU) The actual language syntax of GLSL and the principles behind it
More informationPointers. Lecture 1 Sections Robb T. Koether. Hampden-Sydney College. Wed, Jan 14, 2015
Pointers Lecture 1 Sections 10.1-10.2 Robb T. Koether Hampden-Sydney College Wed, Jan 14, 2015 Robb T. Koether (Hampden-Sydney College) Pointers Wed, Jan 14, 2015 1 / 23 1 Pointers 2 Pointer Initialization
More informationThe Traveling Salesman Problem Brute Force Method
The Traveling Salesman Problem Brute Force Method Lecture 30 Sections 6.1, 6.3 Robb T. Koether Hampden-Sydney College Fri, Nov 3, 2017 Robb T. Koether (Hampden-Sydney College)The Traveling Salesman Problem
More informationNondeterministic Programming in C++
Nondeterministic Programming in C++ Lecture 37 Sections 14.5 Robb T. Koether Hampden-Sydney College Wed, Nov 30, 2016 Robb T. Koether (Hampden-Sydney College) Nondeterministic Programming in C++ Wed, Nov
More informationRotations and Translations
Rotations and Translations Lecture 33 Sections 11.3-11.4 Robb T. Koether Hampden-Sydney College Wed, Nov 20, 2013 Robb T. Koether (Hampden-Sydney College) Rotations and Translations Wed, Nov 20, 2013 1
More informationGPU Programming EE Final Examination
Name GPU Programming EE 4702-1 Final Examination Tuesday, 9 December 2014 7:30 9:30 CST Alias Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Exam Total (20 pts) (15 pts) (20 pts) (20 pts) (25 pts) (100
More informationCMPS160 Shader-based OpenGL Programming
CMPS160 Shader-based OpenGL Programming Shader gallery I Above: Demo of Microsoft s XNA game platform Right: Product demos by nvidia (top) and Radeon (bottom) Shader gallery II Above: Kevin Boulanger (PhD
More informationShaders CSCI 4239/5239 Advanced Computer Graphics Spring 2014
Shaders CSCI 4239/5239 Advanced Computer Graphics Spring 2014 What is a Shader? Wikipedia: A shader is a computer program used in 3D computer graphics to determine the final surface properties of an object
More informationProgrammable shader. Hanyang University
Programmable shader Hanyang University Objective API references (will be skipped) Examples Simple shader Phong shading shader INTRODUCTION GLSL(OPENGL SHADING LANGUAGE) Scalar Data types Structure Structures
More informationMobile Application Programing: Android. OpenGL Operation
Mobile Application Programing: Android OpenGL Operation Activities Apps are composed of activities Activities are self-contained tasks made up of one screen-full of information Activities start one another
More informationCS559 Computer Graphics Fall 2015
CS559 Computer Graphics Fall 2015 Practice Midterm Exam Time: 2 hrs 1. [XX Y Y % = ZZ%] MULTIPLE CHOICE SECTION. Circle or underline the correct answer (or answers). You do not need to provide a justification
More informationLevy: Constraint Texture Mapping, SIGGRAPH, CS 148, Summer 2012 Introduction to Computer Graphics and Imaging Justin Solomon
Levy: Constraint Texture Mapping, SIGGRAPH, 2001 CS 148, Summer 2012 Introduction to Computer Graphics and Imaging Justin Solomon Instructor: Justin Solomon Email: justin.solomon@stanford.edu Office: Clark
More informationList Iterators. Lecture 27 Section Robb T. Koether. Hampden-Sydney College. Wed, Apr 8, 2015
List Iterators Lecture 27 Section 16.5 Robb T. Koether Hampden-Sydney College Wed, Apr 8, 2015 Robb T. Koether (Hampden-Sydney College) List Iterators Wed, Apr 8, 2015 1 / 28 1 Sequential Access 2 List
More informationComputer Graphics Coursework 1
Computer Graphics Coursework 1 Deadline Deadline: 4pm, 24/10/2016 4pm 23/10/2015 Outline The aim of the coursework is to modify the vertex and fragment shaders in the provided OpenGL framework to implement
More informationDensity Curves Sections
Density Curves Sections 3.1-3.2 Lecture 8 Robb T. Koether Hampden-Sydney College Wed, Jan 27, 2016 Robb T. Koether (Hampden-Sydney College) Density CurvesSections 3.1-3.2 Wed, Jan 27, 2016 1 / 18 Outline
More informationCS4621/5621 Fall Computer Graphics Practicum Intro to OpenGL/GLSL
CS4621/5621 Fall 2015 Computer Graphics Practicum Intro to OpenGL/GLSL Professor: Kavita Bala Instructor: Nicolas Savva with slides from Balazs Kovacs, Eston Schweickart, Daniel Schroeder, Jiang Huang
More informationCS770/870 Spring 2017 Open GL Shader Language GLSL
Preview CS770/870 Spring 2017 Open GL Shader Language GLSL Review traditional graphics pipeline CPU/GPU mixed pipeline issues Shaders GLSL graphics pipeline Based on material from Angel and Shreiner, Interactive
More informationCS770/870 Spring 2017 Open GL Shader Language GLSL
CS770/870 Spring 2017 Open GL Shader Language GLSL Based on material from Angel and Shreiner, Interactive Computer Graphics, 6 th Edition, Addison-Wesley, 2011 Bailey and Cunningham, Graphics Shaders 2
More informationToday s Agenda. Basic design of a graphics system. Introduction to OpenGL
Today s Agenda Basic design of a graphics system Introduction to OpenGL Image Compositing Compositing one image over another is most common choice can think of each image drawn on a transparent plastic
More informationTuesday, 23 March OpenGL Shading Language
OpenGL Shading Language GLSL Is a high level shading language based on the C programming language. It was created by the OpenGL ARB to give developers more direct control of the graphics pipeline without
More informationReal-Time Rendering (Echtzeitgraphik) Michael Wimmer
Real-Time Rendering (Echtzeitgraphik) Michael Wimmer wimmer@cg.tuwien.ac.at Walking down the graphics pipeline Application Geometry Rasterizer What for? Understanding the rendering pipeline is the key
More informationGLSL. OpenGL Shading Language. OpenGL 1.5 Logical Diagram. OpenGL 2.0 Logical Diagram
OpenGL Shading Language GLSL Is a high level shading language based on the C programming language. It was created by the OpenGL ARB to give developers more direct control of the graphics pipeline without
More informationThe string Class. Lecture 21 Sections 2.9, 3.9, Robb T. Koether. Wed, Oct 17, Hampden-Sydney College
The string Class Lecture 21 Sections 2.9, 3.9, 3.10 Robb T. Koether Hampden-Sydney College Wed, Oct 17, 2018 Robb T. Koether (Hampden-Sydney College) The string Class Wed, Oct 17, 2018 1 / 18 1 The String
More informationPointer Arithmetic. Lecture 4 Chapter 10. Robb T. Koether. Hampden-Sydney College. Wed, Jan 25, 2017
Pointer Arithmetic Lecture 4 Chapter 10 Robb T. Koether Hampden-Sydney College Wed, Jan 25, 2017 Robb T. Koether (Hampden-Sydney College) Pointer Arithmetic Wed, Jan 25, 2017 1 / 36 1 Pointer Arithmetic
More informationConverts geometric primitives into images Is split into several independent stages Those are usually executed concurrently
Rendering Pipeline Rendering Pipeline Converts geometric primitives into images Is split into several independent stages Those are usually executed concurrently Pipeline 18.10.2013 Steiner- Wallner- Podaras
More informationThe Graphics Pipeline
The Graphics Pipeline Ray Tracing: Why Slow? Basic ray tracing: 1 ray/pixel Ray Tracing: Why Slow? Basic ray tracing: 1 ray/pixel But you really want shadows, reflections, global illumination, antialiasing
More informationShaders CSCI 4229/5229 Computer Graphics Fall 2017
Shaders CSCI 4229/5229 Computer Graphics Fall 2017 What is a Shader? A shader is a computer program that runs on the GPU to calculate the properties of vertexes, pixels and other graphical processing Examples:
More informationGPU Programming EE Final Examination
Name GPU Programming EE 4702-1 Final Examination Friday, 11 December 2015 15:00 17:00 CST Alias Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Exam Total (20 pts) (15 pts) (15 pts) (20 pts)
More informationProgrammable GPUs Outline
papi 1 Outline References Programmable Units Languages Programmable GPUs Outline papi 1 OpenGL Shading Language papi 1 EE 7700-1 Lecture Transparency. Formatted 11:30, 25 March 2009 from set-prog-api.
More informationAmbient and Diffuse Light
Ambient and Diffuse Light Lecture 20 Robb T. Koether Hampden-Sydney College Mon, Oct 12, 2015 Robb T. Koether (Hampden-Sydney College) Ambient and Diffuse Light Mon, Oct 12, 2015 1 / 29 Outline 1 Lighting
More informationList Iterators. Lecture 34 Section Robb T. Koether. Hampden-Sydney College. Wed, Apr 24, 2013
List Iterators Lecture 34 Section 16.5 Robb T. Koether Hampden-Sydney College Wed, Apr 24, 2013 Robb T. Koether (Hampden-Sydney College) List Iterators Wed, Apr 24, 2013 1 / 29 1 Sequential Access 2 List
More informationShading Language Update
3 Shading Language Update Bill Licea-Kane Copyright Khronos Group, 2007 - Page 1 About this talk - Caveat BOFor Contributions to arb-glsl workgroup - NOT final, subject to (minor?) changes Not exhaustive
More information