OUTLINE. Tessellation in OpenGL Tessellation of Bezier Surfaces Tessellation for Terrain/Height Maps Level of Detail
|
|
- Hubert Jacobs
- 5 years ago
- Views:
Transcription
1 TESSELLATION 1
2 OUTLINE Tessellation in OpenGL Tessellation of Bezier Surfaces Tessellation for Terrain/Height Maps Level of Detail 2
3 THE EXAMPLE
4 TESSELLATION SHADING Instead of specifying vertices, you specify a patch Just an ordered set of vertices Tessellation control shader determines how much geometry is generated from patch Other primitives are processed by vertex, fragment and geometry shaders and bypass tessellation You specify the total number of vertices in the patch (with primitives, OpenGL already knows how many vertices to expect) glpatchparameteri(glenum pname, Glint value); pname is set to GL_PATCH_VERTICES value is number of vertices glpatchparameteri(gl_patch_vertices, 4); gldrawarrays(gl_patches, 0, 8);
5 VERTEX SHADER #version 430 uniform mat4 mvp; void main(void) { }
6 TESSELLATION CONTROL SHADER #version 430 uniform mat4 mvp; layout (vertices = 1) out; void main(void) { gl_tesslevelouter[0] = 6; gl_tesslevelouter[2] = 6; gl_tesslevelouter[1] = 6; gl_tesslevelouter[3] = 6; gl_tesslevelinner[0] = 12; gl_tesslevelinner[1] = 12; } Specifies the number of output-patch vertices and specifies how many times the TCS will execute once for each output vertex.
7 TESSELLATION LEVELS
8 QUAD TESSELLATION
9 TRIANGLE TESSELLATION
10 TESSELLATION EVALUATION SHADER Executed once for each tessellation coordinate that the tessellator generates Determines the position of the vertex derived from the coordinate Looks similar to vertex shader Transforming vertices into screen positions (Unless we will use a geometry shader but that s at least one lecture away)
11 TESSELLATION EVALUATION SHADER #version 430 Primitive type can be quads, triangles or isolines layout (quads, equal_spacing, ccw) in; uniform mat4 mvp; cw or ccw for winding order void main (void) { } float u = gl_tesscoord.x; float v = gl_tesscoord.y; gl_position = mvp * vec4(u,0,v,1); equal_spacing, fractional_even_spacing or fractional_odd_spacing
12 SPACING equal_spacing is the default It subdivides the perimeter into the number of segments you specified Looks best here, but has the disadvantage that it rounds up to the nearest integer so if your object changes size you can get visible differences fractional_even and fractional_odd round down but you are left with a fractional triangle somewhere
13 FRAGMENT SHADER #version 430 out vec4 color; uniform mat4 mvp; void main(void) { color = vec4(1.0, 1.0, 0.0, 1.0); }
14 TESSELLATION FOR BEZIER SURFACES
15 VERTEX SHADER #version 430 out vec2 tc; uniform mat4 mvp; layout (binding = 0) uniform sampler2d tex_color; void main(void) { const vec4 vertices[] = vec4[] (vec4(-1.0, 0.5, -1.0, 1.0), vec4(-0.5, 0.5, -1.0, 1.0), vec4( 0.5, 0.5, -1.0, 1.0), vec4( 1.0, 0.5, -1.0, 1.0), vec4(-1.0, 0.0, -0.5, 1.0), vec4(-0.5, 0.0, -0.5, 1.0), vec4( 0.5, 0.0, -0.5, 1.0), vec4( 1.0, 0.0, -0.5, 1.0), vec4(-1.0, 0.0, 0.5, 1.0), vec4(-0.5, 0.0, 0.5, 1.0), vec4( 0.5, 0.0, 0.5, 1.0), vec4( 1.0, 0.0, 0.5, 1.0), vec4(-1.0,-0.5, 1.0, 1.0), vec4(-0.5, 0.3, 1.0, 1.0), vec4( 0.5, 0.3, 1.0, 1.0), vec4( 1.0, 0.3, 1.0, 1.0)); tc = vec2((vertices[gl_vertexid].x + 1.0)/2.0, (vertices[gl_vertexid].z + 1.0)/2.0); gl_position = vertices[gl_vertexid]; }
16 TESSELLATION CONTROL SHADER #version 430 in vec2 tc[]; out vec2 tcs_out[]; uniform mat4 mvp; layout (binding=0) uniform sampler2d tex_color; layout (vertices = 16) out; void main(void) { int TL = 32; // tessellation levels if (gl_invocationid ==0) { gl_tesslevelouter[0] = TL; gl_tesslevelouter[2] = TL; gl_tesslevelouter[1] = TL; gl_tesslevelouter[3] = TL; gl_tesslevelinner[0] = TL; gl_tesslevelinner[1] = TL; } 16 control points per patch tcs_out[gl_invocationid] = tc[gl_invocationid]; gl_out[gl_invocationid].gl_position = gl_in[gl_invocationid].gl_position; }
17 TESSELLATION EVALUATION SHADER #version 430 layout (quads, equal_spacing,ccw) in; uniform mat4 mvp; layout (binding = 0) uniform sampler2d tex_color; in vec2 tcs_out[]; out vec2 tes_out;
18 TESSELLATION EVALUATION SHADER void main (void) { vec3 p00 = (gl_in[0].gl_position).xyz; vec3 p10 = (gl_in[1].gl_position).xyz; vec3 p20 = (gl_in[2].gl_position).xyz; vec3 p30 = (gl_in[3].gl_position).xyz; vec3 p01 = (gl_in[4].gl_position).xyz; vec3 p11 = (gl_in[5].gl_position).xyz; vec3 p21 = (gl_in[6].gl_position).xyz; vec3 p31 = (gl_in[7].gl_position).xyz; vec3 p02 = (gl_in[8].gl_position).xyz; vec3 p12 = (gl_in[9].gl_position).xyz; vec3 p22 = (gl_in[10].gl_position).xyz; vec3 p32 = (gl_in[11].gl_position).xyz; vec3 p03 = (gl_in[12].gl_position).xyz; vec3 p13 = (gl_in[13].gl_position).xyz; vec3 p23 = (gl_in[14].gl_position).xyz; vec3 p33 = (gl_in[15].gl_position).xyz;
19 TESSELLATION EVALUATION SHADER float u = gl_tesscoord.x; float v = gl_tesscoord.y; // cubic Bezier basis functions float bu0 = (1.0-u) * (1.0-u) * (1.0-u); float bu1 = 3.0 * u * (1.0-u) * (1.0-u); float bu2 = 3. * u * u * (1.0-u); float bu3 = u * u * u; float bv0 = (1.0-v) * (1.0-v) * (1.0-v); float bv1 = 3.0 * v * (1.0-v) * (1.0-v); float bv2 = 3. * v * v * (1.0-v); float bv3 = v * v * v; //(1-u)^3 //3u(1-u)^2 //3u^2(1-u) //u^3 //(1-v)^3 //3v(1-v)^2 //3v^2(1-v) //v^3
20 TESSELLATION EVALUATION SHADER // output the position of this vertex in the tessellated patch vec3 outputposition = bu0 * ( bv0*p00 + bv1*p01 + bv2*p02 + bv3*p03 ) + bu1 * ( bv0*p10 + bv1*p11 + bv2*p12 + bv3*p13 ) + bu2 * ( bv0*p20 + bv1*p21 + bv2*p22 + bv3*p23 ) + bu3 * ( bv0*p30 + bv1*p31 + bv2*p32 + bv3*p33 ); gl_position = mvp * vec4(outputposition,1.0f); // shows bezier curve // gl_position = mvp * vec4(u,0,v,1); // shows original grid (pick one) // output the interpolated texture coordinates vec2 tc1 = mix(tcs_out[0], tcs_out[3], gl_tesscoord.x); vec2 tc2 = mix(tcs_out[12], tcs_out[15], gl_tesscoord.x); vec2 tc = mix(tc2, tc1, gl_tesscoord.y); tes_out = tc; }
21 FRAGMENT SHADER #version 430 in vec2 tes_out; out vec4 color; uniform mat4 mvp; layout (binding=0) uniform sampler2d tex_color; void main(void) { color = texture(tex_color, tes_out); }
22 TESSELLATION FOR TERRAIN / HEIGHT MAPS Height mapping from the vertex shader can lose detail Tesselation shaders introduce additional vertices Can use this to flesh out the detail Matches object geometry better Improves silhouette / edge detail Strategy: Place a tesselated grid in the x-z plane Use height map to set y coordinates Doesn t require any patches Use grey scale image for both texture and height map Initial result?
23 TESSELLATION FOR TERRAIN / HEIGHT MAPS White areas should be higher and black areas lower Does not correspond on the result Even by adding vertices with tessellation, the resolution is too low to capture details
24 TESSELLATION FOR TERRAIN / HEIGHT MAPS The solution: Use instancing Remember instancing from way early on? Rendering multiple Java objects with a single Java call Build a patch in the vertex shader Instance the picture with 64x64 patches - results in over 4 million vertices
25 VERTEX SHADER #version 430 out vec2 tc; uniform mat4 mvp; layout (binding = 0) uniform sampler2d tex_color; void main(void) { vec2 patchtexcoords[] = vec2[] (vec2(0,0), vec2(1,0), vec2(0,1), vec2(1,1)); // compute an offset for coordinates based on which instance this is int x = gl_instanceid % 64; int y = gl_instanceid / 64; // texture coordinates are distributed across 64 patches tc = vec2( (x+patchtexcoords[gl_vertexid].x)/64.0, (y+patchtexcoords[gl_vertexid].y)/64.0 ); } // vertex locations range from -0.5 to +0.5 gl_position = vec4(tc.x-0.5, 0.0, (1.0-tc.y)-0.5, 1.0);
26 TESSELLATION CONTROL SHADER #version 430 layout (vertices = 4) out; in vec2 tc[]; out vec2 tcs_out[]; uniform mat4 mvp; layout (binding=0) uniform sampler2d tex_color; void main(void) { int TL = 32; if (gl_invocationid == 0) { gl_tesslevelouter[0] = TL; gl_tesslevelouter[2] = TL; gl_tesslevelouter[1] = TL; gl_tesslevelouter[3] = TL; gl_tesslevelinner[0] = TL; gl_tesslevelinner[1] = TL; } } tcs_out[gl_invocationid] = tc[gl_invocationid]; gl_out[gl_invocationid].gl_position = gl_in[gl_invocationid].gl_position;
27 TESSELLATION EVALUATION SHADER #version 430 layout (quads, equal_spacing,ccw) in; uniform mat4 mvp; layout (binding = 0) uniform sampler2d tex_color; in vec2 tcs_out[]; out vec2 tes_out; void main (void) { // map the texture coordinates onto the sub-grid specified by the incoming control points vec2 tc = vec2(tcs_out[0].x+(gl_tesscoord.x)/64.0, tcs_out[0].y+(1.0-gl_tesscoord.y)/64.0); // map the tessellated grid onto the sub-grid specified by the incoming control points vec4 tessellatedpoint = vec4(gl_in[0].gl_position.x + gl_tesscoord.x / 64.0, 0.0, gl_in[0].gl_position.z + gl_tesscoord.y / 64.0, 1.0); // add the height from the height map to the vertex: tessellatedpoint.y += (texture(tex_color, tc).r) / 40.0; } gl_position = mvp * tessellatedpoint; tes_out = tc;
28 FRAGMENT SHADER #version 430 in vec2 tes_out; out vec4 color; uniform mat4 mvp; layout (binding=0) uniform sampler2d tex_color; void main(void) { color = texture(tex_color, tes_out); } And the result?
29 OVERLY JAGGED
30 ANOTHER ATTEMPT Height mapping detail is somewhat correct, but areas not quite right One problem is using a greyscale texture image for height doesn t quite work Not all variations in greyscale images are due to height- some are just color Another problem we don t have normals so we can do the lighting Solution use a true height map and a normal map Bonus the image now responds to lighting
31 HEIGHT MAP AND NORMAL MAP
32 WITH NORMAL MAP AND LIGHTING
33 SO WHAT S THE DRAWBACK? Imagery is great, but we have over 4 million vertices just to draw the moon surface Any additional graphic objects are going to start taxing the system Solution Only use high resolution in the areas that matter Those that are closer to the viewer Level of Detail: Changing the number of vertices based on the distance from the camera One catch changing detail level, as the object/camera moves can make parts of the image pop or wiggle The fix? Use fractional_even_spacing instead of equal_spacing
34 LEVEL OF DETAIL
35 SUMMARY Tessellation in OpenGL Tessellation of Bezier Surfaces Tessellation for Terrain/Height Maps Level of Detail 35
CSE 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 The OpenGL 4.x pipeline 2 new Programmable stages Tessellation Control Shader(GL_TESS_CONTROL_SHADER)
More informationHow to use tessellation to add geometric detail to your scenes. How to use geometry shaders to process whole primitives and create geometry on the fly
Chapter 8 Primitive Processing WHAT YOU LL LEARN IN THIS CHAPTER How to use tessellation to add geometric detail to your scenes How to use geometry shaders to process whole primitives and create geometry
More informationHW-Tessellation Basics
HW-Tessellation Basics Peter Houska Institute of Computer Graphics and Algorithms Vienna University of Technology Tessellation Video [UnHe] Institute of Computer Graphics and Algorithms 1 What is Tessellation?
More informationA Tessellated Parametric Triangular Bézier Patch
1 CS 457/557 Winter Quarter 2017 Project #7: A Tessellated Parametric Triangular Bézier Patch Due: March 15, 2017 A Parametric Line 2 P 1 P 0 B 0 = (1 u) B 1 = u } Blending Functions A Parametric Triangular
More informationTessellation Shaders
1 Tessellation Shaders Mike Bailey mjb@cs.oregonstate.edu tessellation.pptx Why do we need a Tessellation step right in the pipeline? You can perform adaptive subdivision based on a variety of criteria
More informationCS195V Week 3. GLSL Programming
CS195V Week 3 GLSL Programming Differences in OpenGL and GLSL 4.x A lot of changes made to GLSL 4.x spec (see: http://www. opengl.org/registry/doc/glslangspec.4.00.8.clean.pdf) CS123 used OpenGL 2.x and
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 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 informationCS770/870 Fall 2015 Advanced GLSL
Expanded Graphics Pipeline CS770/870 Fall 2015 Advanced GLSL Geometry definition Shaders can actually be inserted in more places in pipeline Vertex and fragment shaders are most important Vertex shader
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 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 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 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 informationZeyang Li Carnegie Mellon University
Zeyang Li Carnegie Mellon University Recap: Texture Mapping Programmable Graphics Pipeline Bump Mapping Displacement Mapping Environment Mapping GLSL Overview Perlin Noise GPGPU Map reflectance over a
More informationTSBK03 Screen-Space Ambient Occlusion
TSBK03 Screen-Space Ambient Occlusion Joakim Gebart, Jimmy Liikala December 15, 2013 Contents 1 Abstract 1 2 History 2 2.1 Crysis method..................................... 2 3 Chosen method 2 3.1 Algorithm
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 informationTerrain rendering (part 1) Due: Monday, March 10, 10pm
CMSC 3700 Winter 014 Introduction to Computer Graphics Project 4 February 5 Terrain rendering (part 1) Due: Monday, March 10, 10pm 1 Summary The final two projects involves rendering large-scale outdoor
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 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 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 informationOPENGL AND GLSL. Computer Graphics
OPENGL AND GLSL Computer Graphics 1 OUTLINE I. Detecting GLSL Errors II. Drawing a (gasp) Triangle! III. (Simple) Animation 2 Interactive Computer Graphics, http://www.mechapen.com/projects.html WHAT IS
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 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 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 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 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 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 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 informationGraphics Shaders. Theory and Practice. Second Edition. Mike Bailey. Steve Cunningham. CRC Press. Taylor&FnincIs Croup tootutor London New York
Graphics Shaders Second Edition ' -i'nsst«i«{r szizt/siss?.aai^m&/gm^mmm3$8iw3ii Theory and Practice Mike Bailey Steve Cunningham CRC Press Taylor&FnincIs Croup tootutor London New York CRCPrea it an Imprint
More informationLecture 9(B): GPUs & GPGPU
Lecture 9(B): GPUs & GPGPU John-Philip Taylor 26 March 2015 Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) Outline OpenGL Primitives and Vertices Vertex Shader Rasteriser Fragment Shader OpenCL
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 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 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 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 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 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 informationPhong Tessellation for Quads
Phong Tessellation for Quads Jonathan Dupuy 1,2 1 LIRIS, Université Lyon 1 2 LIGUM, Dept. I.R.O., Université de Montréal Figure 1: First 3 levels of Phong tessellation on a quad mesh (the leftmost surface
More informationComputer Graphics Fundamentals. Jon Macey
Computer Graphics Fundamentals Jon Macey jmacey@bournemouth.ac.uk http://nccastaff.bournemouth.ac.uk/jmacey/ 1 1 What is CG Fundamentals Looking at how Images (and Animations) are actually produced in
More informationCS452/552; EE465/505. Clipping & Scan Conversion
CS452/552; EE465/505 Clipping & Scan Conversion 3-31 15 Outline! From Geometry to Pixels: Overview Clipping (continued) Scan conversion Read: Angel, Chapter 8, 8.1-8.9 Project#1 due: this week Lab4 due:
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 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 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 information[175 points] The purpose of this assignment is to give you practice with shaders in OpenGL.
CPSC 441 Computer Graphics Assignment 5 due 11/20/18 (11:59 p.m.) [175 points] The purpose of this assignment is to give you practice with shaders in OpenGL. Part 1: First, download and get the code itself
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 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 informationCSE 167: Lecture #17: Procedural Modeling. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011
CSE 167: Introduction to Computer Graphics Lecture #17: Procedural Modeling Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 Announcements Important dates: Final project outline
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 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 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 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 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 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 informationInformation Coding / Computer Graphics, ISY, LiTH. Splines
28(69) Splines Originally a drafting tool to create a smooth curve In computer graphics: a curve built from sections, each described by a 2nd or 3rd degree polynomial. Very common in non-real-time graphics,
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 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 informationComputergraphics Exercise 15/ Shading & Texturing
Computergraphics Exercise 15/16 3. Shading & Texturing Jakob Wagner for internal use only Shaders Vertex Specification define vertex format & data in model space Vertex Processing transform to clip space
More informationTerrain Rendering (Part 1) Due: Thursday November 30 at 10pm
CMSC 23700 Autumn 2017 Introduction to Computer Graphics Project 5 November 16, 2015 Terrain Rendering (Part 1) Due: Thursday November 30 at 10pm 1 Summary The final project involves rendering large-scale
More informationComputergrafik. Matthias Zwicker Universität Bern Herbst 2016
Computergrafik Matthias Zwicker Universität Bern Herbst 2016 Today More shading Environment maps Reflection mapping Irradiance environment maps Ambient occlusion Reflection and refraction Toon shading
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 informationComputer Graphics CS 543 Lecture 13a Curves, Tesselation/Geometry Shaders & Level of Detail
Computer Graphics CS 54 Lecture 1a Curves, Tesselation/Geometry Shaders & Level of Detail Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) So Far Dealt with straight lines
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 informationScalar Field Visualization I
Scalar Field Visualization I What is a Scalar Field? The approximation of certain scalar function in space f(x,y,z). Image source: blimpyb.com f What is a Scalar Field? The approximation of certain scalar
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 informationRendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane
Rendering Pipeline Rendering Converting a 3D scene to a 2D image Rendering Light Camera 3D Model View Plane Rendering Converting a 3D scene to a 2D image Basic rendering tasks: Modeling: creating the world
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 informationModule Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1
UNIVERSITY OF EAST ANGLIA School of Computing Sciences Main Series PG Examination 2013-14 COMPUTER GAMES DEVELOPMENT CMPSME27 Time allowed: 2 hours Answer any THREE questions. (40 marks each) Notes are
More informationComputer Graphics. Lecture 02 Graphics Pipeline. Edirlei Soares de Lima.
Computer Graphics Lecture 02 Graphics Pipeline Edirlei Soares de Lima What is the graphics pipeline? The Graphics Pipeline is a special software/hardware subsystem
More informationAnimation Essentially a question of flipping between many still images, fast enough
33(70) Information Coding / Computer Graphics, ISY, LiTH Animation Essentially a question of flipping between many still images, fast enough 33(70) Animation as a topic Page flipping, double-buffering
More informationCould you make the XNA functions yourself?
1 Could you make the XNA functions yourself? For the second and especially the third assignment, you need to globally understand what s going on inside the graphics hardware. You will write shaders, which
More informationWhy modern versions of OpenGL should be used Some useful API commands and extensions
Michał Radziszewski Why modern versions of OpenGL should be used Some useful API commands and extensions Timer Query EXT Direct State Access (DSA) Geometry Programs Position in pipeline Rendering wireframe
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 informationOrthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015
Orthogonal Projection Matrices 1 Objectives Derive the projection matrices used for standard orthogonal projections Introduce oblique projections Introduce projection normalization 2 Normalization Rather
More informationMobile graphics API Overview
Mobile graphics API Overview Michael Doggett Department of Computer Science Lund University 2009 Michael Doggett and Tomas Akenine-Möller 1 Register Please check to see if your name is on the list, if
More informationCMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker
CMSC427 Advanced shading getting global illumination by local methods Credit: slides Prof. Zwicker Topics Shadows Environment maps Reflection mapping Irradiance environment maps Ambient occlusion Reflection
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 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 informationContent. Building Geometry Appearance Lights Model Loaders
Content Building Geometry Appearance Lights Model Loaders Building Geometry A Geometry represents a 3D object: Mesh: The form or structure of a shape (What to draw) Material: The color, transparency, and
More informationThe Creep SOP. 3. Delete the sky, logo and ground objects. 4. Place a new geometry object into the Network editor.
1 Film Strip Ribbon 1 THE CREEP SOP In this exercise, you will use the Creep SOP to simulate a length of film that flows off of the reel spool on a frame by frame basis. 1.1 GETTING STARTED 1. Launch Houdini.
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 informationRasterization. CS4620/5620: Lecture 12. Announcements. Turn in HW 1. PPA 1 out. Friday lecture. History of graphics PPA 1 in 4621.
CS4620/5620: Lecture 12 Rasterization 1 Announcements Turn in HW 1 PPA 1 out Friday lecture History of graphics PPA 1 in 4621 2 The graphics pipeline The standard approach to object-order graphics Many
More informationMoving Mobile Graphics Advanced Real-time Shadowing. Marius Bjørge ARM
Moving Mobile Graphics Advanced Real-time Shadowing Marius Bjørge ARM Shadow algorithms Shadow filters Results Agenda SHADOW ALGORITHMS Shadow Algorithms Shadow mapping Depends on light type Directional,
More informationGPU Programming EE Final Examination
Name GPU Programming EE 4702-1 Final Examination Monday, 5 December 2016 17:30 19:30 CST Alias Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Exam Total (20 pts) (20 pts) (15 pts) (20 pts) (25 pts)
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 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 informationProcedural modeling and shadow mapping. Computer Graphics CSE 167 Lecture 15
Procedural modeling and shadow mapping Computer Graphics CSE 167 Lecture 15 CSE 167: Computer graphics Procedural modeling Height fields Fractals L systems Shape grammar Shadow mapping Based on slides
More informationScalar Field Visualization I
Scalar Field Visualization I What is a Scalar Field? The approximation of certain scalar function in space f(x,y,z). Image source: blimpyb.com f What is a Scalar Field? The approximation of certain scalar
More informationFurther Graphics. Advanced Shader Techniques. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd
Further Graphics Advanced Shader Techniques 1 Alex Benton, University of Cambridge alex@bentonian.com Supported in part by Google UK, Ltd Lighting and Shading (a quick refresher) Recall the classic lighting
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 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 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 informationLighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015
Lighting and Shading II 1 Objectives Continue discussion of shading Introduce modified Phong model Consider computation of required vectors 2 Ambient Light Ambient light is the result of multiple interactions
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 informationBuilding Models. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science
Building Models CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce simple data structures for building polygonal models - Vertex lists - Edge
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 informationShadows in the graphics pipeline
Shadows in the graphics pipeline Steve Marschner Cornell University CS 569 Spring 2008, 19 February There are a number of visual cues that help let the viewer know about the 3D relationships between objects
More informationTexture 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 informationCS451Real-time Rendering Pipeline
1 CS451Real-time Rendering Pipeline JYH-MING LIEN DEPARTMENT OF COMPUTER SCIENCE GEORGE MASON UNIVERSITY Based on Tomas Akenine-Möller s lecture note You say that you render a 3D 2 scene, but what does
More informationMobile Application Programming: Android. OpenGL Operation
Mobile Application Programming: Android OpenGL Operation OpenGL ES C-Based Performance-Oriented Graphics Library Wrapper libraries provided for Java, C#, etc. Produces 2D images from 2D or 3D geometric
More information