INF3320 Computer Graphics and Discrete Geometry


 Henry Cain
 1 years ago
 Views:
Transcription
1 INF3320 Computer Graphics and Discrete Geometry The OpenGL pipeline Christopher Dyken and Martin Reimers Page 1
2 The OpenGL pipeline Real Time Rendering: The Graphics Processing Unit (GPU) (Chapter 3) Buffers and Buffering (Chapter 18.1) Perspective Correct Interpolation (Chapter 18.2) The Red Book: Blending, Antialiasing, and Polygon Offset (Chapter 6) The Framebuffer (Chapter 10) Order of Operations (Appendix A) Page 2
3 Pipeline operations Page 3
4 Classic OpenGL has a fixedfunction pipeline: Implements a fixed sequence of operations: transformation of vertices lighting calculations for vertices combining vertices to primitives and rasterization texturing of fragments,... Operations can be turned on or off, but is still not too flexible since the operations themselves are quite fixed. Page 4
5 OpenGL 2.0 introduced a programmable pipeline: Program objects replace part of the pipeline ops with shaders: vertex shaders can replace vertex transform geometry shaders a can replace some of primitive setup fragment shader can replace some of texturing and fragment operations a available through the extension EXT_geometry_shader4 Green = programmable, yellow = configurable, red = fixed Vertex Shader Geometry Shader Clipping Screen Mapping Triangle Setup and Traversal Pixel Shader Merger Page 5
6 glvertex triggers processing of a vertex. Current color, normal, texcoord etc. are attached to the vertex. Fixed function vertex operations vertex coordinates in current normal current material and color vertex/normal transform lighting glenable(gl_lighting) transformed coordinates associated data processed vertex out Vertex position and normal vectors are transformed. current texcoord current edge tag and fog coord gltexgen() texgen texture matrix glenable(gl_texture_gen_*) Example vertex shader varying vec3 normal; need normal in eye coords in fragment shader void main() { gl_position = gl_modelviewprojectionmatrix * gl_vertex; gl_texcoord = gl_texturematrix[0] * gl_multitexcoord0; gl_frontcolor = gl_color; normal = gl_normalmatrix * gl_normal; } Page 6
7 Vertex and normal transform object coords window coords modelview matrix eye coords projection matrix perspective division viewport transform clip coords normalized device coords OpenGL uses the following frames: Vertices are specified in object coords. In eye coords, camera is in origin looking down negative z. Lighting calculations are done here. vec4 ec = gl_modelviewmatrix * gl_vertex In clip coords the volume of the frustum is transformed to [ 1, 1] [ 1, 1] [ 1, 1]. vec4 cc = gl_projectionmatrix * ec Normalized device coords is the Euclidean representation of clipcoords. vec3 nd = cc.xyz / cc.w Window coords is the coordinate system of the screen. Page 7
8 Primitive assembly Page 8
9 Primitive assembly and culling Primitive assembly combines transformed vertices into points, lines, and triangles according to glbeginglend state. Triangles are classified 1 as front or backfacing. When culling is enabled 2, a triangle is discarded if it is backfacing and glcullface(gl_back) is set, or it is frontfacing and glcullface(gl_front) is set. = If an object is closed, we can never see the backside of the triangles, so why process them further? 1 Check the sign of the 2Darea of the triangle. 2 glenable(gl_cull_face) Page 9
10 Clipping Page 10
11 Hyperplanes and halfspaces A hyperplane divides a space into two, a pos and neg side: In R a point is a hyperplane, in R 2 a line is a hyperplane, and in R 3 a plane is a hyperplane. In R d, a hyperplane is defined implicitly by a 1,..., a d+1 : d a i p i + a d+1 > 0 implies that p is in the positive halfspace, i=1 d a i p i + a d+1 < 0 implies that p is in the negative halfspace, i=1 d a i p i + a d+1 = 0 implies that p is on the hyperplane i=1 Page 11
12 Recall that the point p = (x, y, z, w) is on the homogeneous plane m = [ a b c d ] if x [ ] a b c d y z = ax + by + cz + dw = 0. w We can find the intersection of the plane and a line segment p = (1 t)p 1 + tp 2, t [0, 1], by inserting into the equation above, and solve for t... m p = m ((1 t)p 1 + tp 2 ) = 0, Page 12
13 t = mp 1 ) gives the parameter point of the intersection. m (p 2 p 1 If p 1 and p 2 have associated data like color c 1 and c 2, the color c at the intersection point can be linearly interpolated as c = (1 t)c 1 + tc 2. Page 13
14 Clipping line segments in the plane Assume we want to clip against a rectangle in the plane (i.e. R 2 ): Our rectangle is specified by [ ] x [ w, w ] [ h, h ]. y which is the intersection of the four halfplanes, m 1 = [ 1 0 w ] x w, m 2 = [ 1 0 w ] x w, m 3 = [ 0 1 h ] y h, and m 4 = [ 0 1 h ] y h. = A point p = [ x y 1 ] T is inside the rectangle, if m i p 0, for i = 1, 2, 3, 4. Page 14
15 We then clip in the following way: For each hyperplane i = 1, 2, 3, 4, clip the line segment: 1. If both endpoints is outside the halfspace = reject it. = reject the line segment. 2. If both endpoints is inside the halfspace = accept it. = accept the line segment. 3. If one endpoint is inside, and one endpoint is outside = define a new line segment between the endpoint inside and the intersection point. Page 15
16 Clipping convex polygon in the plane The intersection of two convex sets are convex. Halfspaces are convex, and therefore, the clipped result is convex. A polygon is defined as a loop of vertices p 1 p 2 p n p 1 Then, for each halfspace 1. Classify each vertex as inside or outside the halfspace. 2. for each pair of adjacent vertices where one vertex is inside and one is outside, insert the intersection point between. 3. Remove the vertices classified as outside The remaining loop represents the clipped polygon. Page 16
17 Rasterization Page 17
18 Rasterization and the fragment pipeline glenable(gl_fragment_program) point rasterization programmable fragment pipeline fragment program from primitive assembly line rasterization to buffer operations texturing color sum fog polygon rasterization fixed fragment pipeline Rasterization converts primitives into fragments 3. Fragments are then subjected to fragment pipeline and then sent to buffer operations. 3 A pixel before it is written to the framebuffer Page 18
19 Which fragments do a triangle produce? All fragments whose centre is inside the triangle is produced. A tiebreaking rule is used when the centre is on the boundary. = A fragment belongs only to one of two adjacent triangles. Page 19
20 Fragment invariance Fragments hold the following invariance rules: Given the primitive p make a new primitive p by offsetting the coordinates with the integers x, y. Assume that neither p or p is clipped. = p and p produces the exact same fragments, except that fragment f of p is shifted x, y compared to fragment f of p. If you render two primitives with identical vertex coordinates, they produce exactly the same fragments. Why? This is of major importance in multipass techniques where one renders the same geometry more than once. Page 20
21 Interpolating varying variables Barycentric coordinates The barycentric coordinates (α 1, α 2, α 3) of p w.r.t the triangle [p 1, p 2, p 3] are α 1 = area(p, p2, p3) area(p 1, p 2, p 3) α 2 = They are the unique convex weights, i.e. area(p, p1, p3) area(p 1, p 2, p 3) α 3 = area(p, p1, p2) area(p 1, p 2, p 3) p2 α 1, α 2, α 3 0, α 1+α 2+α 3 = 1, u 2 s.t p = α 1p 1 + α 2p 2 + α 3p 3 p1 Yields a parameterization, i.e. a natural map between triangles: u = α 1u 1 + α 2u 2 + α 3u 3. p u u1 p u3 3 p 1 (1, 0, 0) p 2 (0, 1, 0) p 3 (0, 0, 1) 1 2 (p1 + p2) ` 1, 1, p p2 ` 1, 3, (p1 + p2 + p3) ` 1, 1, Page 21
22 Let (α 1, α 2, α 3) be the barycentric coords of the fragment midpoint wrt. the screenspace coordinates of T = [p 1, p 2, p 3]. Interpolating linearly in screen space c 1, c 2, c 3 are the colors at the corners of T. Then, c = α 1c 1 + α 2c 2 + α 3c 3 interpolates the colors linearly in screen space. Looks wrong since perspective distortion is lost! Interpolating linearly in object space Perspective corrected interpolation is given by c = α1 c 1 c w 1 + α 2 c 2 w 2 + α 3 3 w 3 q α 1 q 1 w 1 + α 2 q 2 w 2 + α 3, 3 w 3 q 1, q 2, q 3 are the qcoordinate of the texcoords, for other data q 1 = q 2 = q 3 = 1. Perspective correct interpolation! Turn on with glhint(gl_perspective_correction_hint) Page 22
23 Fixed fragment pipeline Fragments are then submitted to the fragment pipeline: If texturing is enabled = Use texcoords and do a texture lookup = modify the surface color. If secondary color 4 = add secondary colour to the fragment s color If fog is enabled, = use depth to control a blend between the fragment color and a fog colour. The fragment is then sent to framebuffer operations. 4 If glenable(gl_separate_specular_color) is enabled, the specular contribution from the lighting calculations are maintained in a secondary color which is not tampered with by texturing. Page 23
24 The framebuffer Page 24
25 A framebuffer is a set of logical buffers pixel framebuffer height stencil buffer depth buffer blue channel green channel color buffer red channel framebuffer width color buffers (RGBA, front/back, left/right, typically bits) depth buffer (typically bits) stencil buffer (typically 0 8 bits) accumulation buffer (precision like color buffer or higher),... A pixel is the contents of all logical buffers for a location. Page 25
26 Basic Buffer operations Clearing glclear[color Depth Stencil Accum] sets the clear value, e.g. glcleardepth(1.0f) glclear(bitmask) clear the chosen buffers, e.g. glclear(gl_depth_buffer_bit GL_COLOR_BUFFER_BIT) Read and Write gldrawbuffer select col. buffers for writing/clearing glreadbuffer select src for reading (e.g. glreadpixels) Fixedfunction pipeline: each outputbuffer recieve the same output Programmable pipeline: outputbuffers can get individual output Page 26
27 Write masks specifies which of current framebuffer s logical buffers are updated: glcolormask(bool,bool,bool,bool) specifies if the R,G,B, or A channels should be updated. gldepthmask(bool) specifies if the depth buffer should be updated 1. glstencilmask(bitmask) specifies which of the stencilbuffer bitplanes that should be updated. (Comes in a separate front/back mode too) Render only to the stencil buffer turn off the color and depth masks and enable the stencil mask. 1 Use glenable/gldisable with GL_DEPTH_TEST to control the test itself. Page 27
28 Perfragment operations Page 28
29 All fragments are subjected to a series of tests: Fragment and associated data ownership test scissor test alpha test (RGBA) stencil test write framebuffer read / update read / update Logical operations Dithering blending (RGBA) depth test If all tests succeed = fragment is written to the framebuffer If any test fail = fragment is discarded. Page 29
30 Fragment tests Pixel ownership test The OS discard fragments at pixel locations not owned by the context. Scissor test (glscissor(x,y,w,h)) All fragments outside a specified rectangle are discarded. Alpha test (glalphafunc(func,ref)) Compare (func) the fragment s alpha value with a reference value (ref) Let us e.g. render opaque and translucent objects, billboarding... Page 30
31 The stencil test Stencil test Compare value in the stencil buffer with a reference value. glstencilfunc(func,ref,mask) comparison function (never,always,<,<=,!=,...), reference value, and a bitmask for both reference and stencil buffer value Stencil operation The stencil buffer is updated from the result of the stencil and depthtests. glstencilop specifies how the stencil buffer is updated when: the stenciltest fails the stenciltest passes, but depttest fail both the stenciltest and the depthtest passes glenable/disable( GL_STENCIL_TEST ) turns the test on/off. Page 31
32 Stencil test applications DOOM3 shadows: count back and front facing fragments passing depth test Code example: Page 32
33 The depth test The depthbuffer (zbuffer) algorithm clear by setting all depthbuffer elements to far. for each fragment: if fragment s depth < depthbuffer depth = store fragment and update depthbuffer if fragment s depth depthbuffer depth = discard fragment result is that only the nearest fragment is stored for any sequence of fragments. glenable/disable( GL_DEPTH_TEST ) turns the test on/off. gldepthfunc specifies the depth test. Page 33
34 What is stored in the depthbuffer? depth(z) = 2 depth bits` z far z far z near 1 z far z near z z far z near depthbuffer value z near = 10, z far = 1000 z near = 100, z far = 1000 z near = 100, z far = 5000 z near = 100, z far = z value depth is an nbit integer proportional to 1 (i.e. nonlinear). z much precision around the near plane little precision around the far plane Increase depth precision by pushing near plane as far away as possible! The far plane also influences precision, but to a much lesser extent. Zfighting is the result of too little zbuffer precision Two fragments of different zvalues get the same depth value, and the algorithm can t tell which is in front of the other. This results in an ugly pattern where some fragments of one primitive appears in front of the other while others do not. Page 34
35 The merging stage Incoming (src) fragments are merged into the framebuffer (dst): Depth/ztest: replace dst fragment if src is closer Logical operations: AND, XOR,... Blending: combine src and dst Logical operations, gllogicop(op) dst = src OP dst where OP is a logical operation, e.g. AND, OR,... Example: Rubberband Render the rubberband in white using gllogicop( GL_XOR). Rendering once more erases the rubberband ( (a b) b = a) Page 35
36 Blending Blending The incoming fragment s is combined with the color already in the framebuffer. src = F ssrc OP F d dst where src and dst are RGBA, F s are blendfactors and OP is e.g. addoperator Set up with gl[enable Disable](GL_BLEND)  enables blending glblendfunc(f s,f d )  set RGBA blend factors glblendfuncseparate(f s,f d,fs α,fd α )  separate RGB and α blend factors glblendequation(mode)  can be e.g. add, subtract, min, max, etc. The factors F can be: 0, 1, α, src, dst,... Page 36
37 Blending applications Blending is most often based on the alpha channel Transparent objects, render back to front Fog Billboarding Antialiasing Code example: Page 37
38 Fog Popular, cheap effect for giving hints on depth c = f c f + (1 f )c b where c f and c s are fog and surface color, and f can be linear: f (z) = z end z z end z start exponential: f (z) = e d f z squared exponential: f (z) = e (d f z) 2 Fog in OpenGL: GLfloat fogcolor[4] = {0.5, 0.5, 0.5, 1.0}; glenable (GL_DEPTH_TEST); //enable depth testing glenable (GL_FOG); glfogi (GL_FOG_MODE, GL_EXP2); glfogfv (GL_FOG_COLOR, fogcolor); glfogf (GL_FOG_DENSITY, 0.3); glhint (GL_FOG_HINT, GL_NICEST); Page 38
39 Antialiasing Points and lines can be antialiased by Enable blending Calling glenable(gl_*_smooth) Setting gllinewidt/glpointsize Filled polygons are more tricky Multisampling  estimate pixel coverage, combine with alpha Accumulation buffer  average over a number of perturbed images Code example: Page 39
40 Accumulation buffer A color buffer that can accumulate several renderings I glaccum(op,val), e.g. glaccum(gl_accum,0.1) I read from readable buffer (glreadbuffer) I After accumulation, glaccum(gl_return,1) writes back to write to outputbuffers Applications: accumulate perturbed images I Antialiasing I Depth of field I Motion blur Page 40
INF3320 Computer Graphics and Discrete Geometry
INF3320 Computer Graphics and Discrete Geometry The OpenGL pipeline Christopher Dyken and Martin Reimers 12.10.2011 Page 1 Pipeline operations Page 2 OpenGL fixedfunction pipeline: Implements a fixed
More informationE.Order of Operations
Appendix E E.Order of Operations This book describes all the performed between initial specification of vertices and final writing of fragments into the framebuffer. The chapters of this book are arranged
More informationRasterization Overview
Rendering Overview The process of generating an image given a virtual camera objects light sources Various techniques rasterization (topic of this course) raytracing (topic of the course Advanced Computer
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 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 fixedfunction graphics
More informationPixels and Buffers. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science
Pixels and Buffers CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce additional OpenGL buffers Learn to read from / write to buffers Introduce
More informationRealTime Rendering (Echtzeitgraphik) Michael Wimmer
RealTime 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 informationProgramming shaders & GPUs Christian Miller CS Fall 2011
Programming shaders & GPUs Christian Miller CS 354  Fall 2011 Fixedfunction vs. programmable Up until 2001, graphics cards implemented the whole pipeline for you Fixed functionality but configurable
More informationBuffers and Processing Fragments
Buffers and Processing Fragments 2017 Autumn Animação e Visualização Tridimensional 2017/2018 1 OGL Framebuffer Color Buffers: (front back) (left right) Depth Buffer Stencil Buffer 2 Buffers Intro Buffer
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 Pervertex Lighting Projection Transform Homogeneous Division Viewport Transform
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 informationIntroduction to the OpenGL Shading Language
Introduction to the OpenGL Shading Language Randi Rost Director of Developer Relations, 3Dlabs 08Dec2005 1 Why use graphics programmability? Graphics hardware has changed radically Fixed functionality
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 informationAn Interactive Introduction to OpenGL Programming
Define a buffer by its spatial resolution (n n x m) ) and its depth (or precision) k,, the number of bits/pixel Buffers pixel Angel and Shreiner: Interactive Computer Graphics 7E AddisonWesley 2015 2
More informationNormalized Device Coordinate System (NDC) World Coordinate System. Example Coordinate Systems. Device Coordinate System
World Coordinate System Normalized Device Coordinate System (NDC) Model Program Graphics System Workstation Model Program Graphics System Workstation Normally, the User or Object Coordinate System. World
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 informationCS 5610 / Spring Depth Buffering and Hidden Surface Removal
Define a buffer by its spatial resolution (n x m) and its depth (or precision) k, the number of bits/pixel Buffers pixel Angel and Shreiner: Interactive Computer Graphics 7E AddisonWesley 2015 2 Depth
More informationDiscrete Techniques. 11 th Week, Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of
Discrete Techniques 11 th Week, 2010 Buffer Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of bits/pixel Pixel OpenGL Frame Buffer OpenGL Buffers Color buffers
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 informationVISIBILITY & CULLING. Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH
VISIBILITY & CULLING Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH Visibility Visibility Given a set of 3D objects, which surfaces are visible from a specific point
More informationWorld Coordinate System
World Coordinate System Application Model Application Program Graphics System Workstation Normally, the User or Object Coordinate System. World Coordinate Window: A subset of the world coordinate system,
More informationDefinition. Blending & Compositing. Front & Back Buffers. Left & Right Buffers. Blending combines geometric objects. e.g.
Blending & Compositing COMP 3003 Autumn 2005 Definition Blending combines geometric objects e.g. transparency Compositing combines entire images multipass textures accumulating results Both depend on
More informationComputergrafik. Matthias Zwicker. Herbst 2010
Computergrafik Matthias Zwicker Universität Bern Herbst 2010 Today Bump mapping Shadows Shadow mapping Shadow mapping in OpenGL Bump mapping Surface detail is often the result of small perturbations in
More informationClass of Algorithms. Visible Surface Determination. Back Face Culling Test. Back Face Culling: Object Space v. Back Face Culling: Object Space.
Utah School of Computing Spring 13 Class of Algorithms Lecture Set Visible Surface Determination CS56 Computer Graphics From Rich Riesenfeld Spring 13 Object (Model) Space Algorithms Work in the model
More informationCS4620/5620: Lecture 14 Pipeline
CS4620/5620: Lecture 14 Pipeline 1 Rasterizing triangles Summary 1! evaluation of linear functions on pixel grid 2! functions defined by parameter values at vertices 3! using extra parameters to determine
More information1.2.3 The Graphics Hardware Pipeline
Figure 13. The Graphics Hardware Pipeline 1.2.3 The Graphics Hardware Pipeline A pipeline is a sequence of stages operating in parallel and in a fixed order. Each stage receives its input from the prior
More informationLecture 2. Shaders, GLSL and GPGPU
Lecture 2 Shaders, GLSL and GPGPU Is it interesting to do GPU computing with graphics APIs today? Lecture overview Why care about shaders for computing? Shaders for graphics GLSL Computing with shaders
More 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 AttributionNonCommercial NoDerivatives 4.0 International
More informationComputer Graphics. BingYu Chen National Taiwan University
Computer Graphics BingYu Chen National Taiwan University Introduction to OpenGL General OpenGL Introduction An Example OpenGL Program Drawing with OpenGL Transformations Animation and Depth Buffering
More informationProgramming Guide. Aaftab Munshi Dan Ginsburg Dave Shreiner. TT r^addisonwesley
OpenGUES 2.0 Programming Guide Aaftab Munshi Dan Ginsburg Dave Shreiner TT r^addisonwesley Upper Saddle River, NJ Boston Indianapolis San Francisco New York Toronto Montreal London Munich Paris Madrid
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 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 informationShadow Algorithms. CSE 781 Winter HanWei Shen
Shadow Algorithms CSE 781 Winter 2010 HanWei Shen Why Shadows? Makes 3D Graphics more believable Provides additional cues for the shapes and relative positions of objects in 3D What is shadow? Shadow:
More informationEECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing
EECE 478 Rasterization & Scenes Rasterization Learning Objectives Be able to describe the complete graphics pipeline. Describe the process of rasterization for triangles and lines. Compositing Manipulate
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 AddisonWesley 2012 Objectives Introduce the OpenGL shading methods  per vertex shading
More informationComputer Graphics with OpenGL ES (J. Han) Chapter VII Rasterizer
Chapter VII Rasterizer Rasterizer The vertex shader passes the clipspace vertices to the rasterizer, which performs the following: Clipping Perspective division Backface culling Viewport transform Scan
More information2.11 Particle Systems
2.11 Particle Systems 320491: Advanced Graphics  Chapter 2 152 Particle Systems Lagrangian method not meshbased set of particles to model timedependent phenomena such as snow fire smoke 320491: Advanced
More informationCSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation
CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013 Announcements Project 2 due Friday, October 11
More informationCSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012
CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Homework project #2 due this Friday, October
More informationCS452/552; EE465/505. Clipping & Scan Conversion
CS452/552; EE465/505 Clipping & Scan Conversion 331 15 Outline! From Geometry to Pixels: Overview Clipping (continued) Scan conversion Read: Angel, Chapter 8, 8.18.9 Project#1 due: this week Lab4 due:
More informationModels and Architectures
Models and Architectures Objectives Learn the basic design of a graphics system Introduce graphics pipeline architecture Examine software components for an interactive graphics system 1 Image Formation
More informationTriangle Rasterization
Triangle Rasterization Computer Graphics COMP 770 (236) Spring 2007 Instructor: Brandon Lloyd 2/07/07 1 From last time Lines and planes Culling View frustum culling Backface culling Occlusion culling
More informationAdvanced Rendering Techniques
Advanced Rendering Techniques Lecture Rendering Pipeline (Part I) Professor Leandro Augusto Frata Fernandes laffernandes@ic.uff.br Lecture notes available in http://www.ic.uff.br/~laffernandes/teaching/0./topicos_rendering
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 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 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 informationMethodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 11: OpenGL 3 http://inst.eecs.berkeley.edu/~cs184 Methodology for Lecture Lecture deals with lighting (teapot shaded as in HW1) Some Nate
More informationComputer Graphics. Shadows
Computer Graphics Lecture 10 Shadows Taku Komura Today Shadows Overview Projective shadows Shadow texture Shadow volume Shadow map Soft shadows Why Shadows? Shadows tell us about the relative locations
More informationTo Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)
Computer Graphics (Fall 2008) COMS 4160, Lecture 9: OpenGL 1 http://www.cs.columbia.edu/~cs4160 To Do Start thinking (now) about HW 3. Milestones are due soon. Course Course 3D Graphics Pipeline 3D Graphics
More informationRasterization. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 16
Rasterization CS 4620 Lecture 16 1 Announcements A3 due on Thu Will send mail about grading once finalized 2 Pipeline overview you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX
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 informationINF3320 Computer Graphics and Discrete Geometry
INF3320 Computer Graphics and Discrete Geometry Visual appearance Christopher Dyken and Martin Reimers 23.09.2009 Page 1 Visual appearance Real Time Rendering: Chapter 5 Light Sources and materials Shading
More informationModule 13C: Using The 3D Graphics APIs OpenGL ES
Module 13C: Using The 3D Graphics APIs OpenGL ES BREW TM Developer Training Module Objectives See the steps involved in 3D rendering View the 3D graphics capabilities 2 1 3D Overview The 3D graphics library
More informationThe Rasterization Pipeline
Lecture 5: The Rasterization Pipeline (and its implementation on GPUs) Computer Graphics CMU 15462/15662, Fall 2015 What you know how to do (at this point in the course) y y z x (w, h) z x Position objects
More informationTSBK03 ScreenSpace Ambient Occlusion
TSBK03 ScreenSpace 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 informationCS 498 VR. Lecture 184/4/18. go.illinois.edu/vrlect18
CS 498 VR Lecture 184/4/18 go.illinois.edu/vrlect18 Review and Supplement for last lecture 1. What is aliasing? What is Screen Door Effect? 2. How imageorder rendering works? 3. If there are several
More informationTutorial on GPU Programming #2. JoongYoun Lee Supercomputing Center, KISTI
Tutorial on GPU Programming #2 JoongYoun Lee Supercomputing Center, KISTI Contents Graphics Pipeline Vertex Programming Fragment Programming Introduction to Cg Language Graphics Pipeline The process to
More informationOpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL
OpenGL: Open Graphics Library Introduction to OpenGL Part II CS 35150 Graphics API ( Application Programming Interface) Software library Layer between programmer and graphics hardware (and other software
More informationgraphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1
graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline sequence of operations to generate an image using objectorder processing primitives processed oneatatime
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 informationgraphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1
graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline sequence of operations to generate an image using objectorder processing primitives processed oneatatime
More informationShader Programs. Lecture 30 Subsections 2.8.2, Robb T. Koether. HampdenSydney College. Wed, Nov 16, 2011
Shader Programs Lecture 30 Subsections 2.8.2, 2.8.3 Robb T. Koether HampdenSydney College Wed, Nov 16, 2011 Robb T. Koether (HampdenSydney College) Shader Programs Wed, Nov 16, 2011 1 / 43 Outline 1
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 informationRasterization Computer Graphics I Lecture 14. Scan Conversion Antialiasing Compositing [Angel, Ch , ]
15462 Computer Graphics I Lecture 14 Rasterization March 13, 2003 Frank Pfenning Carnegie Mellon University http://www.cs.cmu.edu/~fp/courses/graphics/ Scan Conversion Antialiasing Compositing [Angel,
More informationComputer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping
Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Shadow Buffer Theory Observation:
More informationDeferred Rendering Due: Wednesday November 15 at 10pm
CMSC 23700 Autumn 2017 Introduction to Computer Graphics Project 4 November 2, 2017 Deferred Rendering Due: Wednesday November 15 at 10pm 1 Summary This assignment uses the same application architecture
More informationMotivation. Culling Don t draw what you can t see! What can t we see? Lowlevel Culling
Motivation Culling Don t draw what you can t see! Thomas Larsson Mälardalen University April 7, 2016 Image correctness Rendering speed One day we will have enough processing power!? Goals of realtime
More informationIntroduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico Models and Architectures
More informationRealtime 3D Computer Graphics Virtual Reality
Realtime 3D Computer Graphics Virtual Reality From Vertices to Fragments Overview Overall goal recapitulation: Input: World description, e.g., set of vertices and states for objects, attributes, camera,
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 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 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 informationSign up for crits! Announcments
Sign up for crits! Announcments Reading for Next Week FvD 16.116.3 local lighting models GL 5 lighting GL 9 (skim) texture mapping Modern Game Techniques CS248 Lecture Nov 13 Andrew Adams Overview The
More informationScan line algorithm. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 272
Scan line algorithm The scan line algorithm is an alternative to the seed fill algorithm. It does not require scan conversion of the edges before filling the polygons It can be applied simultaneously to
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 informationCSE 167: Introduction to Computer Graphics Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015
CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015 Announcements Project 2 due tomorrow at 2pm Grading window
More informationOpenGL refresher. Advanced Computer Graphics 2012
Advanced Computer Graphics 2012 What you will see today Outline General OpenGL introduction Setting up: GLUT and GLEW Elementary rendering Transformations in OpenGL Texture mapping Programmable shading
More information3D Rendering Pipeline
3D Rendering Pipeline Reference: RealTime Rendering 3 rd Edition Chapters 2 4 OpenGL SuperBible 6 th Edition Overview Rendering Pipeline Modern CG Inside a Desktop Architecture Shaders Tool Stage Asset
More informationDrawing Fast The Graphics Pipeline
Drawing Fast The Graphics Pipeline CS559 Fall 2015 Lecture 9 October 1, 2015 What I was going to say last time How are the ideas we ve learned about implemented in hardware so they are fast. Important:
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 informationProgramming Graphics Hardware
Tutorial 5 Programming Graphics Hardware Randy Fernando, Mark Harris, Matthias Wloka, Cyril Zeller Overview of the Tutorial: Morning 8:30 9:30 10:15 10:45 Introduction to the Hardware Graphics Pipeline
More informationComputer Graphics. Rendering. by Brian Wyvill University of Calgary. cpsc/enel P 1
Computer Graphics Rendering by Brian Wyvill University of Calgary cpsc/enel P Rendering Techniques Wire Frame Z Buffer Ray Tracing A Buffer cpsc/enel P 2 Rendering Visible Surface Determination Many Algorithms,
More informationIntroduction to the OpenGL Shading Language (GLSL)
1 Introduction to the OpenGL Shading Language (GLSL) This work is licensed under a Creative Commons AttributionNonCommercial NoDerivatives 4.0 International License Mike Bailey mjb@cs.oregonstate.edu
More informationLecture 2. Determinants. Ax = 0. a 11 x 1 + a 12 x a 1n x n = 0 a 21 x 1 + a 22 x a 2n x n = 0
A = a 11 a 12... a 1n a 21 a 22... a 2n. a n1 a n2... a nn x = x 1 x 2. x n Lecture 2 Math Review 2 Introduction to OpenGL Ax = 0 a 11 x 1 + a 12 x 2 +... + a 1n x n = 0 a 21 x 1 + a 22 x 2 +... + a 2n
More informationGraphics Hardware. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 2/26/07 1
Graphics Hardware Computer Graphics COMP 770 (236) Spring 2007 Instructor: Brandon Lloyd 2/26/07 1 From last time Texture coordinates Uses of texture maps reflectance and other surface parameters lighting
More informationFROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU
FROM VERTICES TO FRAGMENTS Lecture 5 Comp3080 Computer Graphics HKBU OBJECTIVES Introduce basic implementation strategies Clipping Scan conversion OCTOBER 9, 2011 2 OVERVIEW At end of the geometric pipeline,
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 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 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 informationEvolution of GPUs Chris Seitz
Evolution of GPUs Chris Seitz Overview Concepts: Realtime rendering Hardware graphics pipeline Evolution of the PC hardware graphics pipeline: 19951998: Texture mapping and zbuffer 1998: Multitexturing
More informationThe Basic Computer Graphics Pipeline, OpenGLstyle. Introduction to the OpenGL Shading Language (GLSL)
Introduction to the OpenGL Shading Language (GLSL) 1 The Basic Pipeline, OpenGLstyle Vertex, Normal, Color ModelViewMatrix, ProjectionMatrix, ModelViewProjectionMatrix 2 MC Model WC View Pervertex Projection
More informationThe Graphics Pipeline
The Graphics Pipeline Ray Tracing: Why Slow? Basic ray tracing: 1 ray/pixel Ray Tracing: Why Slow? Basic ray tracing: 1 ray/pixel But you really want shadows, reflections, global illumination, antialiasing
More informationSungEui Yoon ( 윤성의 )
Introduction to Computer Graphics and OpenGL Graphics Hardware SungEui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/etri_cg/ Class Objectives Understand how GPUs have been evolved Understand
More informationAdaptive Point Cloud Rendering
1 Adaptive Point Cloud Rendering Project Plan Final Group: May1311 Christopher Jeffers Eric Jensen Joel Rausch Client: Siemens PLM Software Client Contact: Michael Carter Adviser: Simanta Mitra 4/29/13
More informationGLSL Introduction. FuChung Huang. Thanks for materials from many other people
GLSL Introduction FuChung 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 informationOpenGl Pipeline. triangles, lines, points, images. Pervertex ops. Primitive assembly. Texturing. Rasterization. Perfragment ops.
OpenGl Pipeline Individual Vertices Transformed Vertices Commands Processor Pervertex ops Primitive assembly triangles, lines, points, images Primitives Fragments Rasterization Texturing Perfragment
More information