Computergraphics Exercise 15/ Shading & Texturing
|
|
- Julius Flowers
- 6 years ago
- Views:
Transcription
1 Computergraphics Exercise 15/16 3. Shading & Texturing Jakob Wagner for internal use only
2 Shaders Vertex Specification define vertex format & data in model space Vertex Processing transform to clip space Vertex Post-processing clipping, perspective divide, viewport transform Primitive Assembly build points/lines/triangles from vertices Vertex Shader Rasterisation scan-convert primitives to fragments, property transfer Fragment Processing computer fragment properties Fragment Shader Fragment Submission testing and blending write to buffer
3 Shaders - contain instructions for the Vertex/Fragment processing stages - use C-like syntax (GLSL) - two types of variables: - Uniforms: explicitly uploaded from CPU, constant value until new value is uploaded - Varyings: shader inputs/outputs, varying between each shader instance - built in variables: minimal Vertex shader outputs/ Fragment Shader inputs necessary for pipeline processing e.g. Vertex position output in Vertex Shader and Fragment position input in Fragment Shader
4 Vertex Shader Vertex Attributes (varying input) - 1st is position in Model Space - 2nd is normal in Model Space layout(location=0) in vec3 in_position; layout(location=1) in vec3 in_normal; Uniforms (constant input) - transformation matrices uploaded with gluniform*v Values passed to Fragment Shader (varying output) - normal in View Space Vertex Processing - position (predefined output) is transformed from Model- to Projection Space - normal is transformed from Model- to View Space uniform mat4 ModelMatrix; uniform mat4 ViewMatrix; uniform mat4 ProjectionMatrix; uniform mat4 NormalMatrix; out vec4 pass_normal; void main() { gl_position = (ProjectionMatrix * ViewMatrix * ModelMatrix) * vec4(in_position, 1.0f); pass_normal = normalize(normalmatrix * vec4(in_normal, 0.0f)); }
5 Fragment Shader Values interpolated from Vertices (varying input) - normal in View Space Values passed to Sample Processing (varying output) - fragment color, 4th component is opacity Fragment Processing - assign fragment RGB components value of the normal XYZ components and make it opaque in vec4 pass_normal; out vec4 out_color; void main() { out_color = vec4(pass_normal.xyz, 1.0f); }
6 Shader Uniforms - are part of ShaderProgram state - value does not change until a new value is uploaded - are shared between all stages of a ShaderProgram - upload uniform value to program a. query uniform location with - program handle - uniform name in Shader b. binding shader program c. upload value to uniform location int location = glgetuniformlocation( program_handle, "NameInShader") gluseprogram(program_handle) gluniformmatrix*v(location,..., data/data_ptr) - querying a location is expensive -> store it and only update when the shader is reloaded - querying locations in a ShaderProgram does not require it to be bound - location of uniform of the same name varies between ShaderPrograms
7 Star Shader - different vertex layout? -> new vertex shader required - 2 inputs: position (vec3) and color (vec3) - color needs to be passed to fragment shader -> vertex shader needs color output variable - fragment shader assigns input color to fragment - Model matrix not necessary because no transformation happens - in update_shader_programs() the star shader needs to be (re)loaded - shader needs View and Projection matrices - uniform locations between shaders vary -> matrix locations in star shader need to be stored in global variable - in update_uniform_locations() the matrix locations in the star shader need to be queried and updated - when modified in update_view() and update_camera(), matrices need to be uploaded to the star shader at their respective location
8 Rasterisation Vertex Specification define vertex format & data in model space Vertex Processing transform to clip space Vertex Post-processing clipping, perspective divide, viewport transform Primitive Assembly build points/lines/triangles from vertices Vertex Shader Rasterisation scan-convert primitives to fragments, property transfer Fragment Processing computer fragment properties Fragment Shader Fragment Submission testing and blending write to buffer
9 Property Transfer variable definition Vertex Shader out vec3 pass_color //predefined out vec4 gl_position... Interpolation Fragment Shader in vec3 pass_color //predefined in vec4 gl_fragcoord... variable interpolation v 1 pass_color 1 = vec3(0.0f, 0.0f, 1.0f) gl_position 1 = vec4(10.0f, 20.0f, 0.0f) d 1 pass_color = vec3(d 1 pass_color 1 + d 2 pass_color 2 + d 3 pass_color 3 ) gl_fragcoord = vec4(d 1 gl_position 1 + d 2 gl_position 2 + d 3 gl_position 3 ) d 2 d v 2 v 3 3 pass_color 2 = vec3(1.0f, 0.0f, 0.0f) gl_position 2 = vec4(0.0f, 0.0f, 0.0f) pass_color 3 = vec3(0.0f, 1.0f,0.0f) gl_position 3 = vec4(20.0f, 0.0f, 0.0f)
10 Perspective-correct Interpolation actual depth z-coordinates (depth) are not linear after projective transformation - very good depth accuracy close to camera - low depth accuracy close to far-plane - output distance between points dependent on distance to camera linear depth linear depth: (v 2 - v 1 ) / (v 4 - v 3 ) = d 1-2 / d 3-4 non-linear depth: (v 2 - v 1 ) / (v 4 - v 3 ) d 1-2 / d 3-4 fragment property interpolation takes place after perspective projection - linear interpolation leads to wrong results - Perspective-correct Interpolation necessary - explanation e.g. in Low, Perspective-Correct Interpolation, 2002 v 1 v 1 v 2 v 2 v 3 v 4 d 1-2 v3 v 2 d 3-4 output v 4 depth actual depth d z d 3-4 input linear depth depth v 1 v 1 v 2 d 1-2 d z
11 Interpolation Qualifiers normal vector interpolation - interpolation can be specified in GLSL: - flat: no interpolation, values from first vertex used -> Flat Shading - smooth: default, perspective-correct interpolation - nonperspective: linear interpolation flat (1 normal per triangle) non-flat (1 normal per vertex) - qualifier for variable must match between shaders texture coordinate interpolation smooth (perspective-correct) nonperspective (linear)
12 Phong Reflection Model Components: - ambient: indirect light incoming from general surroundings ->constant - diffuse: Lambertian reflectance, diffusely reflected light from surface microfacets -> dependent on angle α between surface n and light direction l - specular: reflection of light directly to viewer -> dependent on angle ω between viewer v and light direction reflected from surface l -> specular highlight decay (glossiness) controlled by a Formula: k a,k d,k s,a - material parameters, i a,i d,i s - light parameters when v 1 and v 2 unit vectors, then: cos( (v 1, v 2 )) = <v 1, v 2 > (dot product) I = k a i a + k d i d cos(ω) + k s i s cos(α) a l v ω n α l = k a i a + k d i d <l, n> + k s i s <v, l > a
13 Blinn-Phong Reflection Model reflection operation computation expensive -> approximation by Blinn does not require a reflection Blinn-Phong model: instead of angle between viewer and reflected light dir use angle ρ between normal and halfway vector h between viewer and light h = (l + v) / (ǁl + vǁ) = normalize(v + l) v n ρ ο ο h l I = k a i a + k d i d cos(ω) + k s i s cos(ρ) b = k a i a + k d i d <l, n> + k s i s <n, h> b - with same exponent as Phong model a is too small -> b = 4 a - Blinn approximation is actually empirically more accurate than Phong
14 Blinn-Phong implementation - shading should be computed in View Space -> requires light and fragment position in View Space -> in Vertex Shader calculate position in View Space and pass to Fragment Shader -> upload uniform of sun position (which is vec3(0.0f, 0.0f, 0.0f) in World Space) in View Space to shader using gluniform3f() or gluniform3fv(), update value when when the View Matrix changes - light color properties can be hardcoded in fragment Shader - planet diffuse color can be assigned through a single vec3 uniform that is changed to the respective color before each planet is drawn - planet ambient color can be assumed as being the same as the diffuse color - planet specular color can be assumed as being white - before calculating angles with the dot product, both vectors need to be normalized
15 Texture Mapping creating all surface details with modeling is too expensive -> paint details on texture and project on surface project texture on model by assigning a coordinate on the texture to each vertex (UV coordinates) define 3d coordinates 1 (0.0, 1.0) v define texture coordinates (0.5, 0.8) (1.0, 1.0) apply texture to fragments (0.1, 0.1) (0.9, 0.1) 3 u (0.0, 0.0) (1.0, 0.0) 3 2
16 Texture Specification Concept Implementation Texture Specification Framebuffer Object Texture Storage Texture Parameters Sampling Parameters Texture Data Texture Format glteximage* gltexparameter* upload format define
17 Texture Binding - the OpenGL context has multiple Texture Units named GL_TEXTURE* - each Texture Unit has binding points for each texture type like GL_TEXTURE_2D, GL_PROXY_TEXTURE_1D_ARRAY etc. - there is always one active Texture Unit - all manipulation functions addressed to a Texture Unit binding point are applied to the object at the active Texture Units binding point active GL_TEXTURE_1D GL_TEXTUREk GL_TEXTURE_2D Texture Object... Context GL_TEXTUREk+1... GL_TEXTURE_1D... GL_TEXTURE_2D
18 Texture Access - in the shader, textures are accessed through sampler uniforms Context - the sampler type defines which binding point is accessed - the samplers holds an integer with the index of the Texture Unit that it should access as value - the index must be uploaded to the sampler value with the gluniform1i() function - if two samplers of different type access the same unit, the rendering will fail - one Texture Object can be bound to multiple Texture Units GL_TEXTUREk GL_TEXTURE_2D Texture Object GL_TEXTUREk+1... GL_TEXTURE_1D Texture Object - the active Texture Unit has no effect on the process gluniform1i(tex_location, k) Shader uniform sampler2d colortex = k uniform sampler1d colortex = k+1
19 Texture Specification prepare for formating 1. activate Texture Unit to which to bind texture 2. generate Texture Object 3. bind Texture Object to 2d texture binding point of unit glactivetexture(gl_texture0) glgentextures(1, &texture_object) glbindtexture(gl_texture_2d, texture_object) define mandatory sampling parameters 4. define interpolation type when fragment covers multiple texels (texture pixels) 5. define interpolation type when fragment does not exactly cover one texel gltexparameteri(gl_texture_2d, GL_TEXTURE_MIN_FILTER, GL_LINEAR) gltexparameteri(gl_texture_2d, GL_TEXTURE_MAG_FILTER, GL_LINEAR) define texture data and format 6. format Texture Object bound to the 2d binding point - with no mipmaps - data storage format - in resolution - without border - input data format - channel type - data to upload glteximage2d(gl_texture_2d, 0, internal_format, width,height, 0, input_format, channel_type, data_ptr)
20 Texture Formating glteximage*(target, level, internal_format, width, height, border, input_format, channel_type, data_ptr ) - target: binding point on which to create new image - level: detail level to create image in, 0 when not using mip-maps - internal_format: specifies the number of color components: GL_RED, GL_RG, GL_RGB, GL_RGBA or a special sized or compressed format - width, height: the texture dimensions - border: must be 0, previously the width of a colored border - input_format: the format of the input data, like internal_format but with additional types for compatibility: GL_BGR or GL_RED_INTEGER, for unnormalized data - channel_type: datatype of the pixel data channels: GL_BYTE, GL_FLOAT, GL_INT, or compressed types like GL_UNSIGNED_BYTE_3_3_2
21 Texture Usage prepare for formating 1. activate Texture Unit to which to bind texture 2. bind Texture Object to 2d texture binding point of unit glactivetexture(gl_texturek) glbindtexture(gl_texture_2d, texture_object) upload unit index to shader 3. get location of sampler uniform 4. bind shader for uniform uploading 5. upload index of unit to sampler use sampler in shader 6. declare sampler variable 7. read data from sampler int color_sampler_location = glgetuniformlocation (program_handle, "ColorTex") gluseprogram(program_handle) gluniform1i(color_sampler_location, k) uniform sampler2d ColorTex vec4 color = texture(colortex, tex_coordinate)
22 Planet Texturing Texture Creation - load png or tga files with the texture_loader::file() function - the texture struct that is returned contains all variables necessary for specifying the texture format - create a Texture Object from the texture struct for each planet - query and store the location of the sampler uniform for the color texture - upload the index of the Texture Unit you want to use for the color texture - activate the Texture Unit that you want to use - before drawing each planet, bind the respective texture object
23 Planet Texturing Texture Coordinates - request the model loader to load the texture coordinates by replacing the last parameter model::normal of the model_loader::obj() function with model::normal model::texcoord - in the planet_object initialisation, add another attribute of the type model::texcoord Texture mapping - in the planet vertex shader add another input attribute vec2 in_texcoord that is directly assigned to an output variable vec2 pass_texcoord - in the fragment shader add another input vec2 pass_texcoord - look up the pixel color at pass_texcoord and use it as diffuse and ambient color in the shading computation
Texture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science
Texture Mapping CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce Mapping Methods - Texture Mapping - Environment Mapping - Bump Mapping Consider
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 informationCS4621/5621 Fall Basics of OpenGL/GLSL Textures Basics
CS4621/5621 Fall 2015 Basics of OpenGL/GLSL Textures Basics Professor: Kavita Bala Instructor: Nicolas Savva with slides from Balazs Kovacs, Eston Schweickart, Daniel Schroeder, Jiang Huang and Pramook
More informationDiscussion 3. PPM loading Texture rendering in OpenGL
Discussion 3 PPM loading Texture rendering in OpenGL PPM Loading - Portable PixMap format 1. 2. Code for loadppm(): http://ivl.calit2.net/wiki/images/0/09/loadppm.txt ppm file format: Header: 1. P6: byte
More informationCS 432 Interactive Computer Graphics
CS 432 Interactive Computer Graphics Lecture 7 Part 2 Texture Mapping in OpenGL Matt Burlick - Drexel University - CS 432 1 Topics Texture Mapping in OpenGL Matt Burlick - Drexel University - CS 432 2
More informationSUMMARY. CS380: Introduction to Computer Graphics Texture Mapping Chapter 15. Min H. Kim KAIST School of Computing 18/05/03.
CS380: Introduction to Computer Graphics Texture Mapping Chapter 15 Min H. Kim KAIST School of Computing Materials SUMMARY 2 1 Light blob from PVC plastic Recall: Given any vector w (not necessarily of
More informationGraphics. Texture Mapping 고려대학교컴퓨터그래픽스연구실.
Graphics Texture Mapping 고려대학교컴퓨터그래픽스연구실 3D Rendering Pipeline 3D Primitives 3D Modeling Coordinates Model Transformation 3D World Coordinates Lighting 3D World Coordinates Viewing Transformation 3D Viewing
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 informationOverview. By end of the week:
Overview By end of the week: - Know the basics of git - Make sure we can all compile and run a C++/ OpenGL program - Understand the OpenGL rendering pipeline - Understand how matrices are used for geometric
More informationTSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY
1(84) Information Coding / Computer Graphics, ISY, LiTH TSBK 07 Computer Graphics Ingemar Ragnemalm, ISY 1(84) Lecture 5 3D graphics part 3 Illumination Illumination applied: Shading Surface detail: Mappings
More informationTSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY
1(61) Information Coding / Computer Graphics, ISY, LiTH TSBK 07 Computer Graphics Ingemar Ragnemalm, ISY 1(61) Lecture 6 Texture mapping Skyboxes Environment mapping Bump mapping 2(61)2(61) Texture mapping
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 informationPipeline Operations. CS 4620 Lecture 14
Pipeline Operations CS 4620 Lecture 14 2014 Steve Marschner 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives
More informationLecture 19: OpenGL Texture Mapping. CITS3003 Graphics & Animation
Lecture 19: OpenGL Texture Mapping CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL texture functions and options
More informationCISC 3620 Lecture 7 Lighting and shading. Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping
CISC 3620 Lecture 7 Lighting and shading Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping Exam results Grade distribution 12 Min: 26 10 Mean: 74 8 Median:
More informationCSE 167: Introduction to Computer Graphics Lecture #7: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018
CSE 167: Introduction to Computer Graphics Lecture #7: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018 Announcements Project 2 due this Friday at 2pm Grading in
More informationBuffers. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015
Buffers 1 Objectives Introduce additional WebGL buffers Reading and writing buffers Buffers and Images 2 Buffer Define a buffer by its spatial resolution (n x m) and its depth (or precision) k, the number
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 informationCT5510: Computer Graphics. Texture Mapping
CT5510: Computer Graphics Texture Mapping BOCHANG MOON Texture Mapping Simulate spatially varying surface properties Phong illumination model is coupled with a material (e.g., color) Add small polygons
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 informationCS452/552; EE465/505. Texture Mapping in WebGL
CS452/552; EE465/505 Texture Mapping in WebGL 2-26 15 Outline! Texture Mapping in WebGL Read: Angel, Chapter 7, 7.3-7.5 LearningWebGL lesson 5: http://learningwebgl.com/blog/?p=507 Lab3 due: Monday, 3/2
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 informationTexture Mapping. Computer Graphics, 2015 Lecture 9. Johan Nysjö Centre for Image analysis Uppsala University
Texture Mapping Computer Graphics, 2015 Lecture 9 Johan Nysjö Centre for Image analysis Uppsala University What we have rendered so far: Looks OK, but how do we add more details (and colors)? Texture mapping
More informationFog example. Fog is atmospheric effect. Better realism, helps determine distances
Fog example Fog is atmospheric effect Better realism, helps determine distances Fog Fog was part of OpenGL fixed function pipeline Programming fixed function fog Parameters: Choose fog color, fog model
More informationCPSC 436D Video Game Programming
CPSC 436D Video Game Programming OpenGL/Shaders Opengl RENDERING PIPELINE Copyright: Alla Sheffer 1 Opengl RENDERING PIPELINE C/C++ OpenGL GLSL (automatic) (automatic) GLSL (automatic) opengl Low-level
More informationCS452/552; EE465/505. Image Processing Frame Buffer Objects
CS452/552; EE465/505 Image Processing Frame Buffer Objects 3-12 15 Outline! Image Processing: Examples! Render to Texture Read: Angel, Chapter 7, 7.10-7.13 Lab3 new due date: Friday, Mar. 13 th Project#1
More informationINF3320 Computer Graphics and Discrete Geometry
INF3320 Computer Graphics and Discrete Geometry Texturing Christopher Dyken Martin Reimers 06.10.2010 Page 1 Texturing Linear interpolation Real Time Rendering: Chapter 5: Visual Appearance Chapter 6:
More information三維繪圖程式設計 3D Graphics Programming Design 第七章基礎材質張貼技術嘉大資工系盧天麒
三維繪圖程式設計 3D Graphics Programming Design 第七章基礎材質張貼技術嘉大資工系盧天麒 1 In this chapter, you will learn The basics of texture mapping Texture coordinates Texture objects and texture binding Texture specification
More informationOpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.
OpenGl Pipeline Individual Vertices Transformed Vertices Commands Processor Per-vertex ops Primitive assembly triangles, lines, points, images Primitives Fragments Rasterization Texturing Per-fragment
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 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 0 Objectives Shader Basics Simple Shaders Vertex shader Fragment shaders 1 Vertex
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 informationPipeline Operations. CS 4620 Lecture 10
Pipeline Operations CS 4620 Lecture 10 2008 Steve Marschner 1 Hidden surface elimination Goal is to figure out which color to make the pixels based on what s in front of what. Hidden surface elimination
More informationShadow Rendering. CS7GV3 Real-time Rendering
Shadow Rendering CS7GV3 Real-time Rendering Global Illumination The incoming radiance L i (p,l) at some point p is the outgoing L o (r(p,l)-l) from another point A Recursive Term r(r(p,l), l ) r(r(r(p,l),
More informationINFOGR Computer Graphics
INFOGR Computer Graphics Jacco Bikker & Debabrata Panja - April-July 2017 Lecture 10: Shaders Welcome! INFOGR2016/17 Today s Agenda: Recap: Diffuse Materials The Phong Shading Model Environment
More informationComputergrafik. Matthias Zwicker Universität Bern Herbst 2016
Computergrafik Matthias Zwicker Universität Bern Herbst 2016 2 Today Basic shader for texture mapping Texture coordinate assignment Antialiasing Fancy textures 3 Texture mapping Glue textures (images)
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 17: Shading in OpenGL. CITS3003 Graphics & Animation
Lecture 17: Shading in OpenGL CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL shading methods - per vertex shading
More informationTextures. Texture Mapping. Bitmap Textures. Basic Texture Techniques
Texture Mapping Textures The realism of an image is greatly enhanced by adding surface textures to the various faces of a mesh object. In part a) images have been pasted onto each face of a box. Part b)
More informationGeneral Purpose computation on GPUs. Liangjun Zhang 2/23/2005
General Purpose computation on GPUs Liangjun Zhang 2/23/2005 Outline Interpretation of GPGPU GPU Programmable interfaces GPU programming sample: Hello, GPGPU More complex programming GPU essentials, opportunity
More informationCSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017
CSE 167: Introduction to Computer Graphics Lecture #8: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017 Announcements Project 2 is due this Friday at 2pm Next Tuesday
More informationThe Rasterization Pipeline
Lecture 5: The Rasterization Pipeline Computer Graphics and Imaging UC Berkeley CS184/284A, Spring 2016 What We ve Covered So Far z x y z x y (0, 0) (w, h) Position objects and the camera in the world
More informationCS 4620 Program 3: Pipeline
CS 4620 Program 3: Pipeline out: Wednesday 14 October 2009 due: Friday 30 October 2009 1 Introduction In this assignment, you will implement several types of shading in a simple software graphics pipeline.
More informationSteiner- Wallner- Podaras
Texturing 2 3 Some words on textures Texturing = mapping 2D image to a model (*You will hear more on other texturing- methods in the course.) Not a trivial task! 4 Texturing how it works 5 UV coordinates
More informationINF3320 Computer Graphics and Discrete Geometry
INF3320 Computer Graphics and Discrete Geometry Texturing Christopher Dyken Martin Reimers 06.10.2010 Page 1 Texturing Linear interpolation Real Time Rendering: Chapter 5: Visual Appearance Chapter 6:
More informationIntroduction to Computer Graphics with WebGL
1 Introduction to Computer Graphics with WebGL Ed Angel Lighting in WebGL WebGL lighting Application must specify - Normals - Material properties - Lights State-based shading functions have been deprecated
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 informationToday. Texture mapping in OpenGL. Texture mapping. Basic shaders for texturing. Today. Computergrafik
Computergrafik Today Basic shader for texture mapping Texture coordinate assignment Antialiasing Fancy textures Matthias Zwicker Universität Bern Herbst 2009 Texture mapping Glue textures (images) onto
More informationINFOGR Computer Graphics
INFOGR Computer Graphics Jacco Bikker & Debabrata Panja - April-July 2018 Lecture 10: Shaders Welcome! Ƹ Ƹ Ƹ x M final = T totorso R T down R = x y z 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Operations: 1. Translate
More informationCS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.
CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions The Midterm Exam was given in class on Tuesday, October 16, 2012. 1. [7 pts] Synthetic-Camera Model. Describe the Synthetic-Camera Model : how
More informationBest practices for effective OpenGL programming. Dan Omachi OpenGL Development Engineer
Best practices for effective OpenGL programming Dan Omachi OpenGL Development Engineer 2 What Is OpenGL? 3 OpenGL is a software interface to graphics hardware - OpenGL Specification 4 GPU accelerates rendering
More informationOUTLINE. Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction
TEXTURE MAPPING 1 OUTLINE Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction 2 BASIC STRAGEGY Three steps to applying a texture 1. specify the texture
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. Slides by Ulf Assarsson and Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology
Shading Slides by Ulf Assarsson and Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology Overview of today s lecture l A simple most basic real-time lighting model
More informationShading/Texturing. Dr. Scott Schaefer
Shading/Texturing Dr. Scott Schaefer Problem / Problem / Problem 4/ Problem / Problem / Shading Algorithms Flat Shading Gouraud Shading Phong Shading / Flat Shading Apply same color across entire polygon
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 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 informationLab 9 - Metal and Glass
Lab 9 - Metal and Glass Let the form of an object be what it may, light, shade, and perspective will always make it beautiful. -John Constable Prologue Support code: /course/cs1230/src/labs/lab09 This
More informationTexturing. Slides done bytomas Akenine-Möller and Ulf Assarsson Department of Computer Engineering Chalmers University of Technology
Texturing Slides done bytomas Akenine-Möller and Ulf Assarsson Department of Computer Engineering Chalmers University of Technology 1 Texturing: Glue n-dimensional images onto geometrical objects l Purpose:
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 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 informationComplex Shading Algorithms
Complex Shading Algorithms CPSC 414 Overview So far Rendering Pipeline including recent developments Today Shading algorithms based on the Rendering Pipeline Arbitrary reflection models (BRDFs) Bump mapping
More informationCGT520 Lighting. Lighting. T-vertices. Normal vector. Color of an object can be specified 1) Explicitly as a color buffer
CGT520 Lighting Lighting Color of an object can be specified 1) Explicitly as a color buffer Bedrich Benes, Ph.D. Purdue University Department of Computer Graphics 2) Implicitly from the illumination model.
More informationObjectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading
Objectives Shading in OpenGL Introduce the OpenGL shading methods - per vertex shading vs per fragment shading - Where to carry out Discuss polygonal shading - Flat - Smooth - Gouraud CITS3003 Graphics
More informationCSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016
CSE 167: Introduction to Computer Graphics Lecture #8: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 Announcements Project 2 due this Friday Midterm next Tuesday
More informationPreparing for Texture Access. Stored Texture Shaders. Accessing Texture Maps. Vertex Shader Texture Access
Stored Texture Shaders Preparing for Texture Access These steps are the same when using a shader as when using fixed functionality Make a specific texture unit active by calling glactivetexture Create
More informationECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014
ECS 175 COMPUTER GRAPHICS Ken Joy Winter 2014 Shading To be able to model shading, we simplify Uniform Media no scattering of light Opaque Objects No Interreflection Point Light Sources RGB Color (eliminating
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 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 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 informationStored Texture Shaders
Stored Texture Shaders 157 Preparing for Texture Access These steps are the same when using a shader as when using fixed functionality Make a specific texture unit active by calling glactivetexture Create
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 informationTexture Mapping. Mike Bailey.
Texture Mapping 1 Mike Bailey mjb@cs.oregonstate.edu This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International License TextureMapping.pptx The Basic Idea
More informationComputer graphics 2: Graduate seminar in computational aesthetics
Computer graphics 2: Graduate seminar in computational aesthetics Angus Forbes evl.uic.edu/creativecoding/cs526 Homework 2 RJ ongoing... - Follow the suggestions in the Research Journal handout and find
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 informationShading. Slides by Ulf Assarsson and Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology
Shading Slides by Ulf Assarsson and Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology Overview of today s lecture l A simple most basic real-time lighting model
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 informationScanline Rendering 2 1/42
Scanline Rendering 2 1/42 Review 1. Set up a Camera the viewing frustum has near and far clipping planes 2. Create some Geometry made out of triangles 3. Place the geometry in the scene using Transforms
More informationCS452/552; EE465/505. Intro to Lighting
CS452/552; EE465/505 Intro to Lighting 2-10 15 Outline! Projection Normalization! Introduction to Lighting (and Shading) Read: Angel Chapter 5., sections 5.4-5.7 Parallel Projections Chapter 6, sections
More informationCS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.
CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions The Midterm Exam was given in class on Thursday, October 23, 2008. 1. [4 pts] Drawing Where? Your instructor says that objects should always be
More informationTexture Mapping 1/34
Texture Mapping 1/34 Texture Mapping Offsets the modeling assumption that the BRDF doesn t change in u and v coordinates along the object s surface Store a reflectance as an image called a texture Map
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 informationEDAF80 Introduction to Computer Graphics. Seminar 3. Shaders. Michael Doggett. Slides by Carl Johan Gribel,
EDAF80 Introduction to Computer Graphics Seminar 3 Shaders Michael Doggett 2017 Slides by Carl Johan Gribel, 2010-13 Today OpenGL Shader Language (GLSL) Shading theory Assignment 3: (you guessed it) writing
More informationThe 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 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 informationPROFESSIONAL. WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB. Andreas Anyuru WILEY. John Wiley & Sons, Ltd.
PROFESSIONAL WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB Andreas Anyuru WILEY John Wiley & Sons, Ltd. INTRODUCTION xxl CHAPTER 1: INTRODUCING WEBGL 1 The Basics of WebGL 1 So Why Is WebGL So Great?
More informationGeometry Shaders. And how to use them
Geometry Shaders And how to use them OpenGL Pipeline (part of it) Vertex data Vertex shader Vertices Primitives Geometry shader Primitives Fragments Fragment shader Color Depth Stencil Vertex Data Attributes
More informationComputer Graphics with OpenGL ES (J. Han) Chapter 6 Fragment shader
Computer Graphics with OpenGL ES (J. Han) Chapter 6 Fragment shader Vertex and Fragment Shaders The inputs to the fragment shader Varyings: The per-vertex output variables produced by the vertex shader
More informationhttps://ilearn.marist.edu/xsl-portal/tool/d4e4fd3a-a3...
Assessment Preview - This is an example student view of this assessment done Exam 2 Part 1 of 5 - Modern Graphics Pipeline Question 1 of 27 Match each stage in the graphics pipeline with a description
More informationLab 2-3D Transformations and Vertex Shaders
Lab 2-3D Transformations and Vertex Shaders Support code: /course/cs1230/src/labs/lab02 Demo: /course/cs1230/bin/cs1230_lab02_demo Intro Last week you learned how to draw 2D shapes in OpenGL using VBOs
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 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 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 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 informationRendering Objects. Need to transform all geometry then
Intro to OpenGL Rendering Objects Object has internal geometry (Model) Object relative to other objects (World) Object relative to camera (View) Object relative to screen (Projection) Need to transform
More informationCS195V Week 6. Image Samplers and Atomic Operations
CS195V Week 6 Image Samplers and Atomic Operations Administrata Warp is due today! NBody should go out soon Due in three weeks instead of two Slightly larger in scope First week and a half we be spent
More informationLecture 07: Buffers and Textures
Lecture 07: Buffers and Textures CSE 40166 Computer Graphics Peter Bui University of Notre Dame, IN, USA October 26, 2010 OpenGL Pipeline Today s Focus Pixel Buffers: read and write image data to and from
More information