Programmable shader. Hanyang University
|
|
- Allyson Rice
- 6 years ago
- Views:
Transcription
1 Programmable shader Hanyang University
2 Objective API references (will be skipped) Examples Simple shader Phong shading shader
3 INTRODUCTION
4 GLSL(OPENGL SHADING LANGUAGE)
5 Scalar Data types Structure Structures are similar to that of C language. Vectors and matrices Matrices are column-major ordered. Array A 1-D array is only supported. Dynamic allocation of memory is not available. The length() method can be used to return the length of an array.
6 Qualifiers Type qualifiers Usage
7 Operators
8 Constructors Constructors are special functions primarily used to initialize variables, especially of multicomponent data types, including structures and arrays. They can also be used as expressions. A single scalar value is assigned to all elements of a vector. You can mix and match scalars, vectors, and matrices in your constructor, as long as you end up with enough components to initialize the entire data type. Any extra components are dropped. Matrices are constructed in column-major order. If you provide a single scalar value, that value is used for the diagonal matrix elements, and all other elements are set to 0. Type conversions are performed only using constructors.
9 Another way to get at individual vector components or matrix components is to use array subscript notation. vec v4 = (1.0, 2.0, 3.0, 4.0); v4[2], v4.b, v4.z, v4.p All of them are the ways to access the third component of v4. For matrices, providing a single array index accesses the corresponding matrix column as a vector. Providing a second array index accesses the corresponding vector component. Component selectors(swizzling) Individual components of a vector can be accessed by using dot notation along with {x,y,z,w}, {r,g,b,a}, or {s,t,p,q}. You cannot mix and match selectors from the different notations. You can use the component selectors to rearrange the order of components or replicate them. You can also use them as write masks on the left side of an assignment to select which components are modified.
10 Flow control Loops for, while, and do/while loops are all supported with the same syntax as in C/C++, and they can be nested. if/else You can use if and if/else clauses to select between multiple blocks of code. These conditionals can also be nested.
11 Function All shaders must define a main function, which is the place where execution begins. void main() { } Subroutines Arrays are allowed as arguments, but not as return types. Structures are allowed as arguments and return types. There are 4 optional qualifiers for arguments. Recursive functions are not allowed.
12 VERTEX SHADER
13 Vertex shader Inputs Matrices for geometric transformations and A set of vertex attributes including vertex coordinates, normal vector, vertex color, material properties, texture coordinates, and so on. Processing Vertex transformation the vertex position is transformed from object space to clip space. Lighting Texture Coordinate Generation and Transformation Outputs Clip-space position, front-facing and back-facing primary and secondary colors, texture coordinates, User-defined varying variables.
14 Application Moving vertices Morphing Wave motion Fractals Particle systems Skinning Lighting More realistic lighting models Cartoon shaders
15 Built-in vertex shader variables Built-in attribute input variables Vertex attributes are fed by calling functions such as glvertex*(), glnormal*(), glcolor*(), gltexcoord*(), and so on.
16 Built-in vertex shader variables Special output variables Varying output variables They will be interpolated and passed to fragment shader.
17 Simple vertex shader void main() { gl_position = gl_modelviewprojectionmatrix*gl_vertex; gl_frontcolor = gl_color; } Vertex coordinates which are specified by glvertex*() function are transformed to clip coordinates by the matrix gl_modelviewprojectionmatrix, which is produced by multiplying modelview matrix and projection matrix. The prefix gl_ indicates built-in variable.
18 FRAGMENT SHADER
19 Fragment shader Inputs Fragment Data whose values are produced by interpolating between outputs of vertex shader. front-facing and back-facing primary and secondary colors, texture coordinates, user-defined varying variables, Processing Texture lookup, color sum and blending, fog, Outputs Fragment color and depth
20 Application Per fragment lighting calculations Texture mapping environment mapping bump mapping Image processing
21 Built-in fragment shader variables Input variables Output Variables
22 Simple fragment shader void main() { gl_fragcolor = gl_frontcolor; } gl_frontcolor is produced by interpolating vertex colors which are the output of vertex shader. The prefix gl_ indicates built-in variable.
23 SETUP FOR USING GLSL SHADER
24 Examples: Gouraud shading vs Phong shading Gouraud shading Phong shading
25 Conventional OpenGL rendering pipeline Only support modified Phong illumination model for lighting calculation. Only support Gouraud shading for shading faces. Interpolate vertex shades across each polygon. It may be less efficient than programmable pipeline Programmable pipeline allows to avoid unnecessary operations and produce more compact program.
26 glew library OpenGL extensions are needed in order to use GLSL shader. GLEW(OpenGL Extension Wrangler) library allows to use extension functionalities of OpenGL. You can get at or from SDKs which provided by graphics hardware vendors (such as nvidia OpenGL SDK). Install glew.h, glew32.lib, and glew.dll files in the same manner as installing the glut library. At first, call glewinit() function which bind the function pointers declared in glew.h header file to the extension functions implemented in graphics driver.
27 Setup Steps Step 1: Create Shaders Create handles to shaders Step 2: Specify Shaders load strings that contain shader source Step 3: Compiling Shaders Actually compile source (check for errors) Step 4: Creating Program Objects Program object controls the shaders Step 5: Attach Shaders to Programs Attach shaders to program obj via handle Step 6: Link Shaders to Programs Another step similar to attach Step 7: Enable Program Finally, let GPU know shaders are ready
28 App Setup (SetupRC function) GLhandleARB vshader, fshader, prog; // handles to objects // Step 1: Create a vertex & fragment shader object vshader = glcreateshaderobjectarb(gl_vertex_shader_arb); fshader = glcreateshaderobjectarb(gl_fragment_shader_arb); // Step 2: Load source code strings into shaders glshadersourcearb(vshader, 1, &VS_String, NULL); glshadersourcearb(fshader, 1, &FS_String, NULL); // Step 3: Compile the vertex, fragment shaders. glcompileshaderarb(vshader); glcompileshaderarb(fshader); // Step 4: Create a program object prog = glcreateprogramobjectarb(); // Step 5: Attach the two compiled shaders glattachobjectarb(prog, vshader); glattachobjectarb(prog, fshader); // Step 6: Link the program object gllinkprogramarb(prog); // Step 7: Finally, install program object as part of current state gluseprogramobjectarb(prog);
29 Loading shader source codes GLhandleARB vshader, fshader, prog; // handles to objects // Step 1: Create a vertex & fragment shader object vshader = glcreateshaderobjectarb(gl_vertex_shader_arb); fshader = glcreateshaderobjectarb(gl_fragment_shader_arb); // Step 2: Load source code strings into shaders glshadersourcearb(vshader, 1, &VS_String, NULL); glshadersourcearb(fshader, 1, &FS_String, NULL); // Step 3: Compile the vertex, fragment shaders. glcompileshaderarb(vshader); glcompileshaderarb(fshader); // Step 4: Create a program object prog = glcreateprogramobjectarb(); // Step 5: Attach the two compiled shaders glattachobjectarb(prog, vshader); glattachobjectarb(prog, fshader); // Step 6: Link the program object gllinkprogramarb(prog); // Step 7: Finally, install program object as part of current state gluseprogramobjectarb(prog);
30 ... Error checking GLhandleARB vshader, fshader, prog; // handles to objects // Step 1: Create a vertex & fragment shader object vshader = glcreateshaderobjectarb(gl_vertex_shader_arb); fshader = glcreateshaderobjectarb(gl_fragment_shader_arb); // Step 2: Load source code strings into shaders glshadersourcearb(vshader, 1, &VS_String, NULL); glshadersourcearb(fshader, 1, &FS_String, NULL); // Step 3: Compile the vertex, fragment shaders. glcompileshaderarb(vshader); glcompileshaderarb(fshader); // Step 4: Create a program object prog... = glcreateprogramobjectarb();... // Step 5: Attach the two compiled shaders glattachobjectarb(prog, vshader); glattachobjectarb(prog, fshader); // Step 6: Link the program object gllinkprogramarb(prog); // Step 7: Finally, install program object as part of current state gluseprogramobjectarb(prog);
31 Vertex shader (phong_shading.vert)
32 Uniform Inputs
33 Attribute inputs
34 output Outputs
35 Fragment shader (phong_shading.frag)
36 Uniform inputs
37 Attribute inputs
38 void RenderScene(void) { glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); glenable(gl_lighting); gllightmodelfv(gl_light_model_ambient,ambientlight); gllightfv(gl_light0,gl_ambient,ambientlight); gllightfv(gl_light0,gl_diffuse,diffuselight); glenable(gl_light0); glenable(gl_color_material);... glrotatef(xrotlight, 1.0f, 0.0f, 0.0f); glrotatef(yrotlight, 0.0f, 1.0f, 0.0f); gllightfv(gl_light0,gl_position,lightpos); glpopmatrix(); glcolormaterial(gl_front, GL_AMBIENT_AND_DIFFUSE); glmaterialfv(gl_front, GL_SPECULAR,materialSpecular); glmateriali(gl_front,gl_shininess,100); glcolor3f(0.0f, 1.0f, 0.0);
39 // Fixed-pipeline rendering on the left glviewport(0, 0, width/2, height); gluseprogramobjectarb(0); glutsolidteapot(100.0); // Programmable rendering on the right glviewport(width/2, 0, width/2, height); gluseprogramobjectarb(myshaderprogram); glutsolidteapot(100.0); glbegin(gl_triangl ES) glnormal3f(...) glcolor3f(...) glvertex3f(...)
40 Set custom attribute/uniform values (without the gl_ prefix) The symbolic table for attribute/uniform variables is generated when a program is linked. Query the linked program object for the attribute/uniform variable specified by name and get the index of the variable. GLint i =glgetattriblocation(p, myattrib ) GLint j =glgetuniformlocation(p, myuniform ) Specify the value of the attribute/uniform variable for the current program object using the index. glvertexattrib1f(i,value) gluniform1f(j,value) glvertexattribpointer(i, ) // passing attributes using vertex array
Information 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 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 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 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 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 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 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 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 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 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 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 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 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 informationShader Programs. Lecture 30 Subsections 2.8.2, Robb T. Koether. Hampden-Sydney College. Wed, Nov 16, 2011
Shader Programs Lecture 30 Subsections 2.8.2, 2.8.3 Robb T. Koether Hampden-Sydney College Wed, Nov 16, 2011 Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, 2011 1 / 43 Outline 1
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 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 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 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 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 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 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 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 informationOUTLINE. Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system
GRAPHICS PIPELINE 1 OUTLINE Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system 2 IMAGE FORMATION REVISITED Can we mimic the synthetic
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 informationINTRODUCTION TO OPENGL PIPELINE
CS580: Computer Graphics Min H. Kim KAIST School of Computing Foundations of Computer Graphics INTRODUCTION TO OPENGL PIPELINE 2 1 What is OpenGL? OpenGL = Open Graphics Library An open industry-standard
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 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 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 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 informationBCA611 Video Oyunları için 3B Grafik
BCA611 Video Oyunları için 3B Grafik WebGL - Shader Programming Zümra Kavafoğlu Canvas element The HTML element is used to draw graphics on a web page. Create canvas with id, width and height
More informationGraphics Pipeline & APIs
Graphics Pipeline & APIs CPU Vertex Processing Rasterization Fragment Processing glclear (GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT); glpushmatrix (); gltranslatef (-0.15, -0.15, solidz); glmaterialfv(gl_front,
More informationIntroduction to Computer Graphics. Hardware Acceleration Review
Introduction to Computer Graphics Hardware Acceleration Review OpenGL Project Setup Create a command-line style project in Xcode 4 Select the project file and click Build Phases tab Add OpenGL.framework
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 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 informationOpenGL shaders and programming models that provide object persistence
OpenGL shaders and programming models that provide object persistence COSC342 Lecture 22 19 May 2016 OpenGL shaders We discussed forms of local illumination in the ray tracing lectures. We also saw that
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 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 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 informationGraphics Pipeline & APIs
3 2 4 Graphics Pipeline & APIs CPU Vertex Processing Rasterization Processing glclear (GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT); glpushmatrix (); gltranslatef (-0.15, -0.15, solidz); glmaterialfv(gl_front,
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 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 informationEECS 487: Interactive Computer Graphics
Integrating GLSL with OpenGL EECS 487: Interactive Computer Graphics Lecture 19: Integrating shaders with OpenGL program Vertex-array objects with shaders Miscellaneous shader related stuff Integrating
More informationObjectives. Coupling GLSL to Applications Example applications
GLSL II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico Objectives Coupling GLSL to Applications Example
More informationLighting and Texturing
Lighting and Texturing Michael Tao Michael Tao Lighting and Texturing 1 / 1 Fixed Function OpenGL Lighting Need to enable lighting Need to configure lights Need to configure triangle material properties
More informationIntroduction to OpenGL
Introduction to OpenGL Banafsheh Azari http://www.uni-weimar.de/cms/medien/cg.html What You ll See Today What is OpenGL? Related Libraries OpenGL Command Syntax B. Azari http://www.uni-weimar.de/cms/medien/cg.html
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 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 informationIntroduction to OpenGL Transformations, Viewing and Lighting. Ali Bigdelou
Introduction to OpenGL Transformations, Viewing and Lighting Ali Bigdelou Modeling From Points to Polygonal Objects Vertices (points) are positioned in the virtual 3D scene Connect points to form polygons
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 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 information- Surface Rendering -
Programmable Shaders II - Surface Rendering - 12 th Week, 2008 Sun-Jeong Kim Downloading 2 GLEW OpenGL Extension Wrangler Library http://glew.sourceforge.net/ Cross-platform open-source C/C++ extension
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 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 informationOpenGL. White Square Code 11/4/09. OpenGL. OpenGL. OpenGL
OpenGL OpenGL OpenGL Is a mechanism to create images in a frame buffer Is an API to access that mechanism Is well specified OpenGL Is not a window system Is not a user interface Is not a display mechanism
More informationThe Application Stage. The Game Loop, Resource Management and Renderer Design
1 The Application Stage The Game Loop, Resource Management and Renderer Design Application Stage Responsibilities 2 Set up the rendering pipeline Resource Management 3D meshes Textures etc. Prepare data
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 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 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 informationCopyright Khronos Group 2012 Page 1. Teaching GL. Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012
Copyright Khronos Group 2012 Page 1 Teaching GL Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012 Copyright Khronos Group 2012 Page 2 Agenda Overview of OpenGL family of APIs Comparison
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 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 informationTeacher Assistant : Tamir Grossinger Reception hours: by - Building 37 / office -102 Assignments: 4 programing using
Teacher Assistant : Tamir Grossinger email: tamirgr@gmail.com Reception hours: by email - Building 37 / office -102 Assignments: 4 programing using C++ 1 theoretical You can find everything you need in
More informationShading and Illumination
Shading and Illumination OpenGL Shading Without Shading With Shading Physics Bidirectional Reflectance Distribution Function (BRDF) f r (ω i,ω ) = dl(ω ) L(ω i )cosθ i dω i = dl(ω ) L(ω i )( ω i n)dω
More informationCSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011
CSE 167: Introduction to Computer Graphics Lecture #8: Lighting Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 Announcements Homework project #4 due Friday, October 28 Introduction:
More informationSurface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:
Surface Graphics Objects are explicitely defined by a surface or boundary representation (explicit inside vs outside) This boundary representation can be given by: - a mesh of polygons: 200 polys 1,000
More informationCHAPTER 1 Graphics Systems and Models 3
?????? 1 CHAPTER 1 Graphics Systems and Models 3 1.1 Applications of Computer Graphics 4 1.1.1 Display of Information............. 4 1.1.2 Design.................... 5 1.1.3 Simulation and Animation...........
More informationProgramming Guide. Aaftab Munshi Dan Ginsburg Dave Shreiner. TT r^addison-wesley
OpenGUES 2.0 Programming Guide Aaftab Munshi Dan Ginsburg Dave Shreiner TT r^addison-wesley Upper Saddle River, NJ Boston Indianapolis San Francisco New York Toronto Montreal London Munich Paris Madrid
More informationGraphics Hardware. Instructor Stephen J. Guy
Instructor Stephen J. Guy Overview What is a GPU Evolution of GPU GPU Design Modern Features Programmability! Programming Examples Overview What is a GPU Evolution of GPU GPU Design Modern Features Programmability!
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 informationOPEN GL BACKGROUND. Objectives. Early History of APIs. SGI and GL. PHIGS and X. Modified from Angel 6e book slides
OPEN GL Modified from Angel 6e book slides BACKGROUND Objectives Early History of APIs Development of the OpenGL API OpenGL Architecture OpenGL as a state machine OpenGL as a data flow machine Functions
More informationCS GPU and GPGPU Programming Lecture 7: Shading and Compute APIs 1. Markus Hadwiger, KAUST
CS 380 - GPU and GPGPU Programming Lecture 7: Shading and Compute APIs 1 Markus Hadwiger, KAUST Reading Assignment #4 (until Feb. 23) Read (required): Programming Massively Parallel Processors book, Chapter
More informationIntro to GPU Programming (OpenGL Shading Language) Cliff Lindsay Ph.D. Student CS WPI
Intro to GPU Programming (OpenGL Shading Language) Cliff Lindsay Ph.D. Student CS WPI Talk Summary Topic Coverage Define Shading Languages (loosely) High Level View of GPU Functional Aspects of GPU Example
More informationGLSL II. Objectives. Coupling GLSL to Applications Example applications
GLSL II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico Objectives Coupling GLSL to Applications Example
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 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 informationProgramming Graphics Hardware
Programming Graphics Hardware Computer Graphics, VT 2013 Lecture 10 Johan Nysjö Centre for Image analysis Swedish University of Agricultural Sciences Uppsala University Recap: The fixed-function OpenGL
More informationVisualizing Molecular Dynamics
Visualizing Molecular Dynamics Aiichiro Nakano Collaboratory for Advanced Computing & Simulations Department of Computer Science Department of Physics & Astronomy Department of Chemical Engineering & Materials
More informationLets assume each object has a defined colour. Hence our illumination model is looks unrealistic.
Shading Models There are two main types of rendering that we cover, polygon rendering ray tracing Polygon rendering is used to apply illumination models to polygons, whereas ray tracing applies to arbitrary
More information2.11 Particle Systems
2.11 Particle Systems 320491: Advanced Graphics - Chapter 2 152 Particle Systems Lagrangian method not mesh-based set of particles to model time-dependent phenomena such as snow fire smoke 320491: Advanced
More information5.2 Shading in OpenGL
Fall 2017 CSCI 420: Computer Graphics 5.2 Shading in OpenGL Hao Li http://cs420.hao-li.com 1 Outline Normal Vectors in OpenGL Polygonal Shading Light Sources in OpenGL Material Properties in OpenGL Example:
More informationLetterkenny Institute of Technology
Letterkenny Institute of Technology BSc in Computing in Games Development Subject: Computer Graphics for Games Programming 2 Level: 7 Date: January 2008 Examiners: Dr. J.G. Campbell Dr. M.D.J. McNeill
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 informationCS 130 Final. Fall 2015
CS 130 Final Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying
More informationWebGL: Hands On. DevCon5 NYC Kenneth Russell Software Engineer, Google, Inc. Chair, WebGL Working Group
WebGL: Hands On DevCon5 NYC 2011 Kenneth Russell Software Engineer, Google, Inc. Chair, WebGL Working Group Today's Agenda Introduce WebGL and its programming model. Show code for a complete example. Demonstrate
More informationPrimitive processing and advanced shading architecture for embedded space. Digital Media Professionals, Inc
Primitive processing and advanced shading architecture for embedded space Maxim Kazakov Eisaku Ohbuchi Digital Media Professionals, Inc Contributions Vertex cache-accelerated fixed and variable size primitive
More informationShading in OpenGL. Outline. Defining and Maintaining Normals. Normalization. Enabling Lighting and Lights. Outline
CSCI 420 Computer Graphics Lecture 10 Shading in OpenGL Normal Vectors in OpenGL Polygonal Shading Light Source in OpenGL Material Properties in OpenGL Approximating a Sphere [Angel Ch. 6.5-6.9] Jernej
More informationPipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11
Pipeline Operations CS 4620 Lecture 11 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives to pixels RASTERIZATION
More informationAPI for creating a display window and using keyboard/mouse interations. See RayWindow.cpp to see how these are used for Assignment3
OpenGL Introduction Introduction OpenGL OpenGL is an API for computer graphics. Hardware-independent Windowing or getting input is not included in the API Low-level Only knows about triangles (kind of,
More informationCS475/CS675 - Computer Graphics. OpenGL Drawing
CS475/CS675 - Computer Graphics OpenGL Drawing What is OpenGL? Open Graphics Library API to specify geometric objects in 2D/3D and to control how they are rendered into the framebuffer. A software interface
More informationOpenGL SUPERBIBLE. Fifth Edition. Comprehensive Tutorial and Reference. Richard S. Wright, Jr. Nicholas Haemel Graham Sellers Benjamin Lipchak
OpenGL SUPERBIBLE Fifth Edition Comprehensive Tutorial and Reference Richard S. Wright, Jr. Nicholas Haemel Graham Sellers Benjamin Lipchak AAddison-Wesley Upper Saddle River, NJ Boston Indianapolis San
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 informationOpenGL. Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University
OpenGL Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University Background Software interface to graphics hardware 250+ commands Objects (models) are built from geometric primitives
More informationTechnical Game Development II. Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS 4731 Computer Graphics
Shader Programming Technical Game Development II Professor Charles Rich Computer Science Department rich@wpi.edu Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS
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 informationCS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J.
CS 380 Introduction to Computer Graphics LAB (1) : OpenGL Tutorial 2018. 03. 05 Reference : Foundations of 3D Computer Graphics, Steven J. Gortler Goals Understand OpenGL pipeline Practice basic OpenGL
More informationTechnical Game Development II. Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS 4731 Computer Graphics
Shader Programming Technical Game Development II Professor Charles Rich Computer Science Department rich@wpi.edu Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS
More informationOpenGL Performances and Flexibility
OpenGL Performances and Flexibility Marco Di Benedetto Visual Computing Laboratory ISTI CNR, Italy OpenGL Roadmap 1.0 - Jan 1992 - First Version 1.1 - Jan 1997 - Vertex Arrays, Texture Objects 1.2 - Mar
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 informationCSE 4431/ M Advanced Topics in 3D Computer Graphics. TA: Margarita Vinnikov
CSE 4431/5331.03M Advanced Topics in 3D Computer Graphics TA: Margarita Vinnikov mvinni@cse.yorku.ca What do we need to do to use shaders in our program? Shaders Work flow For multiple shaders 1. Create
More information