Introduction to Computer Graphics. April 6, 2017 Kenshi Takayama
|
|
- Buddy Hart
- 6 years ago
- Views:
Transcription
1 Introduction to Computer Graphics April 6, 2017 Kenshi Takayama
2 Lecturers Kenshi Takayama (Assistant Prof., NII) Toshiya Hachisuka (Junior Associate Prof.) Ryoichi Ando (Assistant Prof., NII) Ag3RwxUAAAAJ&hl=en TA:Seung-Tak Noh (Igarashi Lab) aknoh/home 2
3 Course overview Modeling Animation Rendering Image processing 2~3 lectures per topic, 12 lectures in total Rendering part by Prof. Hachisuka Fluid animation part by Prof. Ando 3
4 Grading Programming assignments only No exam, no attendance check Two tyes of assignments: Basic & Advanced Basic 1 assignent per topic (4 in total), very easy Advanced For motivated students Deadline: The end of July Evaluation criteria 1 assignemnt submitted C (bare minimum for the degree) 4 assignments submitted B or higher Distribution of S & A will be decided based on the quality/creativity of submissions and the overall balance in the class More details explained later 4
5 References Course website Famous textbooks (not used in the class) Fundamentals of Computer Graphics ( ) Computer Graphics: Principles and Practice in C ( ) 5
6 Lecturers research topics 6
7 Coordinate transformations 7
8 Linear transformation In 2D: x y = a b c d x y In 3D: x y z = a b c d e f g h i x y z Intuition: Mapping of coordinate axes a c = a b c d 1 0 0, 1 b, d b d Origin stays put a b = c d 0 1 1, 0 a, c 8
9 Special linear transformations Rotation Scaling Shearing (X dir.) Shearing (Y dir.) cos θ sin θ sin θ cosθ s x 0 0 s y 1 k k 1 9
10 Linear transformation + translation = Affine transformation x y = a b c d x y + t x ty x y 1 = a b t x c d t y x y 1 Homogeneous coordinates: Use a 3D (4D) vector to represent a 2D (3D) point Can concisely represent linear transformation & translation as matrix multiplication Easier implementation 10
11 Combining affine transformations Just multiply matrices Careful with the ordering! R = T = cos θ sin θ 0 sin θ cos θ t x 0 1 t y x = R T x x = T R x 11
12 Another role of homogeneous coordinates: Perspective projection Objects apparent sizes on the screen are inversely proportional to the object-camera distance Orthographic projection Perspective projection 12
13 Another role of homogeneous coordinates: Perspective projection When w 0, 4D homogeneous coordinate x, y, z, w represents x a 3D position, y, z w w w Camera at the origin, screen on the plane Z=1 p x, p y, p z is projected to w x, w y = p x, p x p z p z X Z= Projection matrix p x p y p z 1 = p x p y p z + 1 p z p x /p z p y /p z 1 + 1/p z 1 w x w y w z Z w z (depth value) is used for occlusion test Z-buffering 13
14 Orthographic projection Objects apparent sizes don t depend on the camera position Simply ignore Z coordinates Orthographic Perspective Frequently used in CAD 14
15 Viewing pipeline Projection trans. (4x4 matrix) Modelview trans. (4x4 matrix) Projected coord. system Camera coord. system Viewport trans. (x, y, w, h) w h y x Window coord. system Object (world) coord. system Local coord. system 15
16 Classical OpenGL code glviewport(0, 0, 640, 480); Viewport transform glmatrixmode(gl_projection); glloadidentity(); gluperspective( Projection transform 45.0, // field of view 640 / 480, // aspect ratio 0.1, 100.0); // depth range glmatrixmode(gl_modelview); glloadidentity(); glulookat( 0.5, 0.5, 3.0, // view point Modelview transform 0.0, 0.0, 0.0, // focus point 0.0, 1.0, 0.0); // up vector glbegin(gl_lines); glcolor3d(1, 0, 0); glvertex3d(0, 0, 0); glvertex3d(1, 0, 0); glcolor3d(0, 1, 0); glvertex3d(0, 0, 0); glvertex3d(0, 1, 0); glcolor3d(0, 0, 1); glvertex3d(0, 0, 0); glvertex3d(0, 0, 1); glend(); Output Scene content 16
17 Z-buffering 17
18 Hidden surface removal Without hidden surface removal With hidden surface removal Classic problem in CG 18
19 Painter s algorithm Sort objects according to distances to camera, then draw them in the back-to-front order Fundamentally ill-suited for many cases Sorting is also not always straightforward 19
20 Z-buffering For each pixel, store distance to the camera (depth) More memory-consuming, but today s standard 20
21 Typical issues with Z-buffering: Z-fighting Multiple polygons at exact same position Impossible to determine which is front/back Strange patterns due to rounding errors 21
22 Typical issues with Z-buffering: Simultaneous drawing of faces and lines Dedicated OpenGL trick: glpolygonoffset Without polygon offset With polygon offset 22
23 Typical issues with Z-buffering: Depth range gluperspective( 45.0, // field of view 640 / 480, // aspect ratio 0.1, ); // znear, zfar znear= zfar =1000 Fixed bits for Z-buffer Typically, 16~24bits Larger depth range Larger drawing space, less accuracy Smaller depth range More accuracy, smaller drawing space (clipped) znear=50 zfar =100 23
24 Rasterization vs Ray-tracing Purpose Idea Real-time CG (games) Per-polygon processing High-quality CG (movies) Per-pixel (ray) processing One polygon updates multiple pixels One ray interacts with multiple polygons Hidden surface removal Z-buffering (OpenGL / DirectX) By nature More details by Prof. Hachisuka 24
25 Quaternions 25
26 Rotation about arbitrary axis Needed in various situations (e.g. camera manipulation) about X-axis about Y-axis about Z-axis about arbitrary axis Problems with matrix representation Overly complex! u x, u y, u z : axis vector Degree of Freedom Should be represented by 2 DoF (axis direction) + 1 DoF (angle) = 3 DoF Can t handle interpolation (blending) well 26
27 Geometry of axis-angle rotation v u: axis (unit vector) u v θ: angle v: input position u(u v) θ v v : output position u O v = v u u v cos θ + u v sin θ + u u v 27
28 Complex number & quaternion Complex number i 2 = 1 c = a, b a + b i c 1 c 2 = a 1, b 1 a 2, b 2 = a 1 a 2 b 1 b 2 + a 1 b 2 + b 1 a 2 i Quaternion i 2 = j 2 = k 2 = ijk = 1 ij = ji = k, jk = kj = i, ki = ik = j q = a, b, c, d a + b i + c j + d k Not commutative! q 1 q 2 = a 1, b 1, c 1, d 1 a 2, b 2, c 2, d 2 = a 1 a 2 b 1 b 2 c 1 c 2 d 1 d 2 + a 1 b 2 + b 1 a 2 + c 1 d 2 d 1 c 2 i + a 1 c 2 + c 1 a 2 + d 1 b 2 b 1 d 2 j + a 1 d 2 + d 1 a 2 + b 1 c 2 c 1 b 2 k 28
29 Notation by scalar + 3D vector q = a + b i + c j + d k a + b, c, d = a + v q 1 q 2 = a 1 a 2 b 1 b 2 c 1 c 2 d 1 d 2 + a 1 b 2 + b 1 a 2 + c 1 d 2 d 1 c 2 i + a 1 c 2 + c 1 a 2 + d 1 b 2 b 1 d 2 j + a 1 d 2 + d 1 a 2 + b 1 c 2 c 1 b 2 k = a 1 a 2 v 1 v 2 + a 1 v 2 + a 2 v 1 + v 1 v 2 29
30 Rotation using quaternions Note: u is a unit vector = v u u v cos α + u v sin α + u u v Interesting theory behind (cf. Wikipedia) 30
31 Rotation interpolation using quaternions Linear interp + normalization (nlerp) nlerp q 1, q 2, t normalize 1 t q 1 + t q 2 less computation, non-uniform angular speed nlerp(t ) q 2 q 1 1 t t Spherical linear interpolation (slerp) Ω = cos 1 q 1 q 2 slerp q 1, q 2, t sin 1 t Ω sin Ω q 1 + sin tω sin Ω q 2 more computation, constant angular speed slerp(t ) q 2 1 t t q 1 Animating rotation with quaternion curves. Shoemake, SIGGRAPH
32 Signs of quaternions Quaternion with angle θ: v q q v q = cos θ 2 + u sin θ 2 Quaternion with angle θ 2π: cos θ 2π 2 + u sin θ 2π 2 = q u When interpolating from q 1 to q 2, negate q 2 if q 1 q 2 is negative Otherwise, the interpolation path becomes longer 32
33 How to work on assignments 33
34 Choices for implementing real-time CG Two kinds of APIs for using GPU Different API designs (slightly?) Both supported by most popular programming languages Many choices for system- & langualge-dependent parts GUI management, handling images,... Many libraries: GUI: GLUT (C), GLFW (C), SDL (C), Qt (C++), MFC (C++), wxwidgets (C++), Swing (Java),... Images: libpng, OpenCV, ImageMagick Often quite some work to get started 34
35 = JavaScript + Runs on many (mobile) browsers HTML-based can easily handle multimedia & GUI No compiling! Quick trial & error Some performance concerns Increasingly popular today 35
36 for Embedded Systems Hurdle in WebGL development: OpenGL ES No support for legacy OpenGL API Reasons: Less efficient Burden on hardware vendors Immediate mode Polygonal primitives Light & material Transform. matrices Display list Default shaders glbegin, glvertex, glcolor, gltexcoord GL_QUADS, GL_POLYGON gllight, glmaterial GL_MODELVIEW, GL_PROJECTION glnewlist Allowed API: Prepare arrays, send them to GPU, draw them using custom shaders Shaders Shader variables Arrays Drawing glcreateshader, glshadersource, glcompileshader, glcreateprogram, glattachshader, gllinkprogram, gluseprogram glgetattriblocation, glenablevertexattribarray, glgetuniformlocation, gluniform glcreatebuffer, glbindbuffer, glbufferdata, glvertexattribpointer gldrawarrays 36
37 C / OpenGL 1.x #include <GL/glut.h> void disp( void ) { float f; glclear(gl_color_buffer_bit); glpushmatrix(); for(f = 0 ; f < 1 ; f += 0.1) { glcolor3f(f, 0, 0); glcalllist(1); } glpopmatrix(); glflush(); } void setdisplist( void ) { glnewlist(1, GL_COMPILE); glbegin(gl_polygon); glvertex2f(-1.2, -0.9); glvertex2f(0.6, -0.9); glvertex2f(-0.3, 0.9); glend(); gltranslatef(0.1, 0, 0); glendlist(); } int main(int argc, char ** argv) { glutinit(&argc, argv); glutinitwindowsize(400, 300); glutinitdisplaymode(glut_rgba); glutcreatewindow("kitty on your lap"); glutdisplayfunc(disp); setdisplist(); glutmainloop(); } WebGL <html><head> <title>learning WebGL lesson 1</title> <script type="text/javascript" src="glmatrix min.js"></script> <script id="shader-fs" type="x-shader/x-fragment"> precision mediump float; void main(void) { gl_fragcolor = vec4(1.0, 1.0, 1.0, 1.0); } </script> <script id="shader-vs" type="x-shader/x-vertex"> attribute vec3 avertexposition; uniform mat4 umvmatrix; uniform mat4 upmatrix; void main(void) { gl_position = upmatrix * umvmatrix * vec4(avertexposition, 1.0); } </script> <script type="text/javascript"> var gl; function initgl(canvas) { gl = canvas.getcontext("experimental-webgl"); gl.viewportwidth = canvas.width; gl.viewportheight = canvas.height; } function getshader(gl, id) { var shaderscript = document.getelementbyid(id); var str = ""; var k = shaderscript.firstchild; while (k) { if (k.nodetype == 3) { str += k.textcontent; } k = k.nextsibling; } var shader; if (shaderscript.type == "x-shader/x-fragment") { shader = gl.createshader(gl.fragment_shader); } else if (shaderscript.type == "x-shader/x-vertex") { shader = gl.createshader(gl.vertex_shader); } gl.shadersource(shader, str); gl.compileshader(shader); return shader; } var shaderprogram; function initshaders() { var fragmentshader = getshader(gl, "shader-fs"); var vertexshader = getshader(gl, "shader-vs"); shaderprogram = gl.createprogram(); gl.attachshader(shaderprogram, vertexshader); gl.attachshader(shaderprogram, fragmentshader); gl.linkprogram(shaderprogram); gl.useprogram(shaderprogram); shaderprogram.vertexpositionattribute = gl.getattriblocation(shaderprogram, "avertexposition"); gl.enablevertexattribarray(shaderprogram.vertexpositionattribute); shaderprogram.pmatrixuniform = gl.getuniformlocation(shaderprogram, "upmatrix"); shaderprogram.mvmatrixuniform = gl.getuniformlocation(shaderprogram, "umvmatrix"); } var mvmatrix = mat4.create(); var pmatrix = mat4.create(); var vertices = [ 0.0, 1.0, 0.0, -1.0, -1.0, 0.0, 1.0, -1.0, 0.0 ]; gl.bufferdata(gl.array_buffer, new Float32Array(vertices), gl.static_draw); trianglevertexpositionbuffer.itemsize = 3; trianglevertexpositionbuffer.numitems = 3; squarevertexpositionbuffer = gl.createbuffer(); gl.bindbuffer(gl.array_buffer, squarevertexpositionbuffer); vertices = [ 1.0, 1.0, 0.0, -1.0, 1.0, 0.0, 1.0, -1.0, 0.0, -1.0, -1.0, 0.0 ]; gl.bufferdata(gl.array_buffer, new Float32Array(vertices), gl.static_draw); squarevertexpositionbuffer.itemsize = 3; squarevertexpositionbuffer.numitems = 4; } function drawscene() { gl.viewport(0, 0, gl.viewportwidth, gl.viewportheight); gl.clear(gl.color_buffer_bit gl.depth_buffer_bit); mat4.perspective(45, 1.5, 0.1, 100.0, pmatrix); mat4.identity(mvmatrix); mat4.translate(mvmatrix, [-1.5, 0.0, -7.0]); gl.bindbuffer(gl.array_buffer, trianglevertexpositionbuffer); gl.vertexattribpointer(shaderprogram.vertexpositionattribute, trianglevertexpositionbuffer.itemsize, gl.float, false, 0, 0); setmatrixuniforms(); gl.drawarrays(gl.triangles, 0, trianglevertexpositionbuffer.numitems); mat4.translate(mvmatrix, [3.0, 0.0, 0.0]); gl.bindbuffer(gl.array_buffer, squarevertexpositionbuffer); gl.vertexattribpointer(shaderprogram.vertexpositionattribute, squarevertexpositionbuffer.itemsize, gl.float, false, 0, 0); setmatrixuniforms(); gl.drawarrays(gl.triangle_strip, 0, squarevertexpositionbuffer.numitems); } function webglstart() { var canvas = document.getelementbyid("lesson01-canvas"); initgl(canvas); initshaders(); initbuffers(); gl.clearcolor(0.0, 0.0, 0.0, 1.0); gl.enable(gl.depth_test); drawscene(); } </script></head> <body onload="webglstart();"> <canvas id="lesson01-canvas" style="border: none;" width="500" height="500"> </canvas> </body> </html> 37
38 Libraries for easing WebGL development Many popular ones: three.js, O3D, OSG.JS,... All APIs are high-level, quite different from legacy OpenGL API Good for casual users, but maybe not for CS students (?) <script src="js/three.min.js"></script> <script> var camera, scene, renderer, geometry, material, mesh; function init() { scene = new THREE.Scene(); camera = new THREE.PerspectiveCamera( 75, 640 / 480, 1, ); camera.position.z = 1000; geometry = new THREE.BoxGeometry( 200, 200, 200 ); material = new THREE.MeshBasicMaterial({color:0xff0000, wireframe:true}); mesh = new THREE.Mesh( geometry, material ); scene.add( mesh ); renderer = new THREE.WebGLRenderer(); renderer.setsize(640, 480); document.body.appendchild( renderer.domelement ); } function animate() { requestanimationframe( animate ); render(); } function render() { mesh.rotation.x += 0.01; mesh.rotation.y += 0.02; renderer.render( scene, camera ); } init(); animate(); </script> High-level API three.js 38
39 legacygl.js Developed by me for this course Demos & tutorial Assignemnts sample codes will be mostly using this Try playing with it and see how it works 39
40 WebGL development using Mozilla Thimble A free web space for putting js/html/css Online editing and quick previewing 40
41 How to work on assignemnts Implement your solution using WebGL, upload it to the web, the URL to the TA Thimble is recommended, but other means (e.g. your own server) is also OK Include some descriptions/discussions/etc in the HTML page OK to use other WebGL libraries (e.g. three.js) Other programming languages (e.g. C++) are also acceptable Should compile and run on typical computing systems Include source+binary+doc in a single ZIP file If you have any questions, don t hesitate to contact TA or me! 41
42 Shaders Vertex shader Vertex shader: per-vertex processing Per-vertex data passed by glbufferdata Vertex position, color, texture coordinate,... Mandatory operation: Specify vertex location on the screen after coordinate transformation (gl_position) Fragment shader: per-pixel processing Do something with rasterized (=linearly interpolated) data Mandatory operation: Specify pixel color to be drawn (gl_fragcolor) Fragment shader GLSL (OpenGL Shading Language) codes passed to GPU as strings compiled at runtime 42
43 Shader variables uniform variables Readable from vertex/fragment shaders Passed to GPU separately from vertex arrays (gluniform) Examples: modelview/projection matrices, flags attribute variables Readable only from vertex shaders Vertex array data passed to GPU via glbufferdata Examples: XYZ position, RGB color, UV texcoord uniform mat4 u_modelview; uniform mat4 u_projection; attribute vec3 a_vertex; attribute vec3 a_color; varying vec3 v_color; void main(void) { gl_position = u_projection * u_modelview * vec4(a_vertex, 1.0); v_color = a_color; } Vertex shader varying variables Written by vertex shader, read by fragment shader Per-vertex data linearly interpolated at this pixel (Grammar differs slightly with versions) precision mediump float; varying vec3 v_color; void main(void) { gl_fragcolor.rgb = v_color; gl_fragcolor.a = 1.0; } Fragment shader 43
44 Tips for JavaScript beginners (=me) 7 types: String / Bool / Number / Function / Object / null / undefined Unlike C++ Number: always double precision No distinction between integer & floating point Object: associative map with string keys x.abc is equivalent to x["abc"] (as if a member ) { abc : y } is equivalent to { "abc" : y } Non-string keys are implicitly converted to strings Arrays are special objects with keys being consecutive integers With additional capabilities:,,.pop(), Always pass-by-value when assigning & passing arguments No language support for deep copy When in doubt, use.length.push().foreach() console.log(x) 44
45 References OpenGL Official spec WebGL/JavaScript/HTML5 Learning WebGL Official spec Mozilla Developer Network An Introduction to JavaScript for Sophisticated Programmers Effective JavaScript 45
46 References
Introduction to OpenGL/GLSL and WebGL GLSL
Introduction to OpenGL/GLSL and WebGL GLSL Objectives! Give you an overview of the software that you will be using this semester! OpenGL, WebGL, and GLSL! What are they?! How do you use them?! What does
More informationWebGL: Hands On. DevCon5 NYC Kenneth Russell Software Engineer, Google, Inc. Chair, WebGL Working Group
WebGL: Hands On DevCon5 NYC 2011 Kenneth Russell Software Engineer, Google, Inc. Chair, WebGL Working Group Today's Agenda Introduce WebGL and its programming model. Show code for a complete example. Demonstrate
More informationWeb-Based Visualization
Web-Based Visualization Web-Based Visualization 11-1 Motivation Nowadays, web browser become more and more capable of displaying graphical content. Different packages are available for creating such content,
More informationWebGL Game Development
WebGL Game Development Sumeet Arora Chapter No. 1 "Getting Started with WebGL Game Development" In this package, you will find: A Biography of the author of the book A preview chapter from the book, Chapter
More informationModels and Architectures. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015
Models and Architectures 1 Objectives Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for an interactive graphics system 2 Image Formation Revisited
More informationCS452/552; EE465/505. Image Formation
CS452/552; EE465/505 Image Formation 1-15-15 Outline! Image Formation! Introduction to WebGL, continued Draw a colored triangle using WebGL Read: Angel, Chapters 2 & 3 Homework #1 will be available on
More informationPrecept 2 Aleksey Boyko February 18, 2011
Precept 2 Aleksey Boyko February 18, 2011 Getting started Initialization Drawing Transformations Cameras Animation Input Keyboard Mouse Joystick? Textures Lights Programmable pipeline elements (shaders)
More informationComp 410/510 Computer Graphics Spring Programming with OpenGL Part 2: First Program
Comp 410/510 Computer Graphics Spring 2017 Programming with OpenGL Part 2: First Program Objectives Refine the first program Introduce a standard program structure - Initialization Program Structure Most
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 informationLecture 4 of 41. Lab 1a: OpenGL Basics
Lab 1a: OpenGL Basics William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://snipurl.com/1y5gc Course web site: http://www.kddresearch.org/courses/cis636 Instructor
More informationProgramming with OpenGL Complete Programs Objectives Build a complete first program
Programming with OpenGL Complete Programs Objectives Build a complete first program Introduce shaders Introduce a standard program structure Simple viewing Two-dimensional viewing as a special case of
More informationObjectives. Programming with WebGL Part 1: Background. Retained vs. Immediate Mode Graphics. Early History of APIs. PHIGS and X.
Objectives Programming with WebGL Part 1: Background CS 432 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Development of the OpenGL API OpenGL Architecture - OpenGL
More informationProgramming shaders & GPUs Christian Miller CS Fall 2011
Programming shaders & GPUs Christian Miller CS 354 - Fall 2011 Fixed-function vs. programmable Up until 2001, graphics cards implemented the whole pipeline for you Fixed functionality but configurable
More informationComp4422. Computer Graphics. Lab 02: WebGL API Prof. George Baciu. PQ838 x7272.
Comp4422 Computer Graphics Lab 02: WebGL API www.comp.polyu.edu.hk/~csgeorge/comp4422 Prof. George Baciu csgeorge@comp.polyu.edu.hk PQ838 x7272 9/6/2018 COMP4422 Lab 02 George Baciu 2018 1 WebGL Prerequisites
More informationProgramming with WebGL Part 1: Background. CS 432 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science
Programming with WebGL Part 1: Background CS 432 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley
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 informationCS452/552; EE465/505. Review & Examples
CS452/552; EE465/505 Review & Examples 2-05 15 Outline Review and Examples:! Shaders, Buffers & Binding! Example: Draw 3 Triangles Vertex lists; gl.drawarrays( ) Edge lists: gl.drawelements( )! Example:
More informationWebGL A quick introduction. J. Madeira V. 0.2 September 2017
WebGL A quick introduction J. Madeira V. 0.2 September 2017 1 Interactive Computer Graphics Graphics library / package is intermediary between application and display hardware Application program maps
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 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 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 informationC OMPUTER G RAPHICS Thursday
C OMPUTER G RAPHICS 2017.04.27 Thursday Professor s original PPT http://calab.hanyang.ac.kr/ Courses Computer Graphics practice3.pdf TA s current PPT not uploaded yet GRAPHICS PIPELINE What is Graphics
More informationComp 410/510 Computer Graphics Spring Programming with OpenGL Part 3: Shaders
Comp 410/510 Computer Graphics Spring 2018 Programming with OpenGL Part 3: Shaders Objectives Basic shaders - Vertex shader - Fragment shader Programming shaders with GLSL Finish first program void init(void)
More informationOpenGL pipeline Evolution and OpenGL Shading Language (GLSL) Part 2/3 Vertex and Fragment Shaders
OpenGL pipeline Evolution and OpenGL Shading Language (GLSL) Part 2/3 Vertex and Fragment Shaders Prateek Shrivastava CS12S008 shrvstv@cse.iitm.ac.in 1 GLSL Data types Scalar types: float, int, bool Vector
More informationAPI Background. Prof. George Wolberg Dept. of Computer Science City College of New York
API Background Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Graphics API history OpenGL API OpenGL function format Immediate Mode vs Retained Mode Examples The Programmer
More informationCS475/CS675 - Computer Graphics. OpenGL Drawing
CS475/CS675 - Computer Graphics OpenGL Drawing What is OpenGL? Open Graphics Library API to specify geometric objects in 2D/3D and to control how they are rendered into the framebuffer. A software interface
More 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 informationGraphics Programming
Graphics Programming 3 rd Week, 2011 OpenGL API (1) API (application programming interface) Interface between an application program and a graphics system Application Program OpenGL API Graphics Library
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 informationGame Graphics & Real-time Rendering
Game Graphics & Real-time Rendering CMPM 163, W2018 Prof. Angus Forbes (instructor) angus@ucsc.edu Lucas Ferreira (TA) lferreira@ucsc.edu creativecoding.soe.ucsc.edu/courses/cmpm163 github.com/creativecodinglab
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 informationTransformations. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science
Transformations CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce standard transformations - Rotation - Translation - Scaling - Shear Derive
More informationUlf Assarsson Department of Computer Engineering Chalmers University of Technology
Ulf Assarsson Department of Computer Engineering Chalmers University of Technology 1. I am located in room 4115 in EDIT-huset 2. Email: 3. Phone: 031-772 1775 (office) 4. Course assistant: Tomas Akenine-Mőller
More informationUlf Assarsson Department of Computer Engineering Chalmers University of Technology
Ulf Assarsson Department of Computer Engineering Chalmers University of Technology Tracing Photons One way to form an image is to follow rays of light from a point source finding which rays enter the lens
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 informationLecture 11 Shaders and WebGL. October 8, 2015
Lecture 11 Shaders and WebGL October 8, 2015 Review Graphics Pipeline (all the machinery) Program Vertex and Fragment Shaders WebGL to set things up Key Shader Concepts Fragment Processing and Vertex
More informationObjectives. transformation. General Transformations. Affine Transformations. Notation. Pipeline Implementation. Introduce standard transformations
Objectives Transformations CS Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Introduce standard transformations - Rotation - Translation - Scaling - Shear Derive homogeneous
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 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 informationInteraction. CSCI 420 Computer Graphics Lecture 3
CSCI 420 Computer Graphics Lecture 3 Interaction Jernej Barbic University of Southern California Client/Server Model Callbacks Double Buffering Hidden Surface Removal Simple Transformations [Angel Ch.
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 informationWebGL. Creating Interactive Content with WebGL. Media #WWDC14. Session 509 Dean Jackson and Brady Eidson WebKit Engineers
Media #WWDC14 WebGL Creating Interactive Content with WebGL Session 509 Dean Jackson and Brady Eidson WebKit Engineers 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted
More informationCSE 167: Introduction to Computer Graphics Lecture #5: Visibility, OpenGL
CSE 167: Introduction to Computer Graphics Lecture #5: Visibility, OpenGL Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 Announcements Tomorrow: assignment 1 due Grading
More information2/3/16. Interaction. Triangles (Clarification) Choice of Programming Language. Buffer Objects. The CPU-GPU bus. CSCI 420 Computer Graphics Lecture 3
CSCI 420 Computer Graphics Lecture 3 Interaction Jernej Barbic University of Southern California [Angel Ch. 2] Triangles (Clarification) Can be any shape or size Well-shaped triangles have advantages for
More informationOpenGL/GLUT Intro. Week 1, Fri Jan 12
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner OpenGL/GLUT Intro Week 1, Fri Jan 12 http://www.ugrad.cs.ubc.ca/~cs314/vjan2007 News Labs start next week Reminder:
More informationBooks, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D
Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D CS334 Spring 2012 Daniel G. Aliaga Department of Computer Science Purdue University Computer Graphics Pipeline Geometric Primitives
More informationThe Graphics Pipeline and OpenGL I: Transformations!
! The Graphics Pipeline and OpenGL I: Transformations! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 2! stanford.edu/class/ee267/!! Albrecht Dürer, Underweysung der Messung mit
More informationCSE 167: Introduction to Computer Graphics Lecture #5: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017
CSE 167: Introduction to Computer Graphics Lecture #5: Projection Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017 Announcements Friday: homework 1 due at 2pm Upload to TritonEd
More informationThe Graphics Pipeline and OpenGL I: Transformations!
! The Graphics Pipeline and OpenGL I: Transformations! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 2! stanford.edu/class/ee267/!! Logistics Update! all homework submissions:
More informationBooks, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt
Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt CS334 Fall 2015 Daniel G. Aliaga Department of Computer Science Purdue University Books (and by now means complete ) Interactive Computer
More informationBasic Graphics Programming
15-462 Computer Graphics I Lecture 2 Basic Graphics Programming Graphics Pipeline OpenGL API Primitives: Lines, Polygons Attributes: Color Example January 17, 2002 [Angel Ch. 2] Frank Pfenning Carnegie
More informationOver the past 15 years, OpenGL has become
Editors: Beatriz Sousa Santos and Ginger Alford The Case for Teaching Computer Graphics with WebGL: A 25-Year Perspective Ed Angel University of New Mexico Over the past 15 years, OpenGL has become the
More informationBCA611 Video Oyunları için 3B Grafik
BCA611 Video Oyunları için 3B Grafik WebGL - Shader Programming Zümra Kavafoğlu Canvas element The HTML element is used to draw graphics on a web page. Create canvas with id, width and height
More information3D computer graphics: geometric modeling of objects in the computer and rendering them
SE313: Computer Graphics and Visual Programming Computer Graphics Notes Gazihan Alankus, Spring 2012 Computer Graphics 3D computer graphics: geometric modeling of objects in the computer and rendering
More informationProgramming with OpenGL Part 2: Complete Programs Computer Graphics I, Fall
Programming with OpenGL Part 2: Complete Programs 91.427 Computer Graphics I, Fall 2008 1 1 Objectives Refine first program Alter default values Introduce standard program structure Simple viewing 2-D
More informationComputer Graphics Seminar
Computer Graphics Seminar MTAT.03.305 Spring 2018 Raimond Tunnel Computer Graphics Graphical illusion via the computer Displaying something meaningful (incl art) Math Computers are good at... computing.
More informationAn Overview GLUT GLSL GLEW
OpenGL, GLUT, GLEW, GLSL An Overview GLUT GLEW GLSL Objectives Give you an overview of the software that you will be using this semester OpenGL, GLUT, GLEW, GLSL What are they? How do you use them? What
More informationINTRODUCTION TO OPENGL PIPELINE
CS580: Computer Graphics Min H. Kim KAIST School of Computing Foundations of Computer Graphics INTRODUCTION TO OPENGL PIPELINE 2 1 What is OpenGL? OpenGL = Open Graphics Library An open industry-standard
More informationTeacher Assistant : Tamir Grossinger Reception hours: by - Building 37 / office -102 Assignments: 4 programing using
Teacher Assistant : Tamir Grossinger email: tamirgr@gmail.com Reception hours: by email - Building 37 / office -102 Assignments: 4 programing using C++ 1 theoretical You can find everything you need in
More informationLectures OpenGL Introduction
Lectures OpenGL Introduction By Tom Duff Pixar Animation Studios Emeryville, California and George Ledin Jr Sonoma State University Rohnert Park, California 2004, Tom Duff and George Ledin Jr 1 What is
More informationConverts geometric primitives into images Is split into several independent stages Those are usually executed concurrently
Rendering Pipeline Rendering Pipeline Converts geometric primitives into images Is split into several independent stages Those are usually executed concurrently Pipeline 18.10.2013 Steiner- Wallner- Podaras
More informationAnnouncement. Homework 1 has been posted in dropbox and course website. Due: 1:15 pm, Monday, September 12
Announcement Homework 1 has been posted in dropbox and course website Due: 1:15 pm, Monday, September 12 Today s Agenda Primitives Programming with OpenGL OpenGL Primitives Polylines GL_POINTS GL_LINES
More informationLecture 2 CISC440/640 Spring Department of Computer and Information Science
Lecture 2 CISC440/640 Spring 2015 Department of Computer and Information Science Today s Topic The secrets of Glut-tony 2 So let s do some graphics! For the next week or so this is your world: -1 1-1 1
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 informationComputer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)
Computer Graphics (CS 47) Lecture : Implementing Transformations Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Objectives Learn how to implement transformations in OpenGL
More informationRendering Pipeline/ OpenGL
Chapter 2 Basics of Computer Graphics: Your tasks for the weekend Piazza Discussion Group: Register Post review questions by Mon noon Use private option, rev1 tag Start Assignment 1 Test programming environment
More informationCS452/552; EE465/505. Overview of Computer Graphics
CS452/552; EE465/505 Overview of Computer Graphics 1-13-15 Outline! What is Computer Graphics? a historical perspective! Draw a triangle using WebGL Computer Graphics! Computer graphics deals with all
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 informationAPI for creating a display window and using keyboard/mouse interations. See RayWindow.cpp to see how these are used for Assignment3
OpenGL Introduction Introduction OpenGL OpenGL is an API for computer graphics. Hardware-independent Windowing or getting input is not included in the API Low-level Only knows about triangles (kind of,
More informationIntroduction to Computer Graphics. Hardware Acceleration Review
Introduction to Computer Graphics Hardware Acceleration Review OpenGL Project Setup Create a command-line style project in Xcode 4 Select the project file and click Build Phases tab Add OpenGL.framework
More informationOpenGL. Toolkits.
http://www.opengl.org OpenGL Open Graphics Library Graphics API Delivered with UNIX, Win9x/2000/Me/Nt/Xp, Mac OS Direct3D (DirectX) is only Windows Utilizes the window system and event handling of the
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 informationLecture 3. Understanding of OPenGL programming
Lecture 3 Understanding of OPenGL programming What is OpenGL GL: stands for Graphic Library Software interface for rendering purposes for 2D or 3D geometric data objects. Various Pieces gl: The basic libraries.
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 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 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 informationModeling Transform. Chapter 4 Geometric Transformations. Overview. Instancing. Specify transformation for objects 李同益
Modeling Transform Chapter 4 Geometric Transformations 李同益 Specify transformation for objects Allow definitions of objects in own coordinate systems Allow use of object definition multiple times in a scene
More informationComputer Graphics (Basic OpenGL)
Computer Graphics (Basic OpenGL) Thilo Kielmann Fall 2008 Vrije Universiteit, Amsterdam kielmann@cs.vu.nl http://www.cs.vu.nl/ graphics/ Computer Graphics (Basic OpenGL, Input and Interaction), ((57))
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 informationToday. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline
Computergrafik Today Rendering pipeline s View volumes, clipping Viewport Matthias Zwicker Universität Bern Herbst 2008 Rendering pipeline Rendering pipeline Hardware & software that draws 3D scenes on
More informationCSC 470 Computer Graphics
CSC 470 Computer Graphics Transformations of Objects CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 1 Transformations of objects - 2D CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 2 Using
More informationIntroduction to OpenGL Transformations, Viewing and Lighting. Ali Bigdelou
Introduction to OpenGL Transformations, Viewing and Lighting Ali Bigdelou Modeling From Points to Polygonal Objects Vertices (points) are positioned in the virtual 3D scene Connect points to form polygons
More 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 informationIntroduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL Ed Angel The Mandelbrot Set Fractals Fractal (fractional geometry) objects generate some of the most complex and beautiful graphics - The mathematics describing
More informationIntroduction to Computer Graphics with OpenGL/GLUT
Introduction to Computer Graphics with OpenGL/GLUT What is OpenGL? A software interface to graphics hardware Graphics rendering API (Low Level) High-quality color images composed of geometric and image
More informationProgramming using OpenGL: A first Introduction
Programming using OpenGL: A first Introduction CMPT 361 Introduction to Computer Graphics Torsten Möller Machiraju/Zhang/Möller 1 Today Overview GL, GLU, GLUT, and GLUI First example OpenGL functions and
More informationTransformation Pipeline
Transformation Pipeline Local (Object) Space Modeling World Space Clip Space Projection Eye Space Viewing Perspective divide NDC space Normalized l d Device Coordinatesd Viewport mapping Screen space Coordinate
More informationComputer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)
Computer Graphics (CS 47) Lecture : Implementing Transformations Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Objectives Learn how to implement transformations in OpenGL
More informationBasic Graphics Programming
CSCI 480 Computer Graphics Lecture 2 Basic Graphics Programming January 11, 2012 Jernej Barbic University of Southern California http://www-bcf.usc.edu/~jbarbic/cs480-s12/ Graphics Pipeline OpenGL API
More information// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations
#include int main(int argc, char** argv) { glutinit(&argc, argv); Typical OpenGL/GLUT Main Program // GLUT, GLU, and OpenGL defs // program arguments // initialize glut and gl // double buffering
More informationGL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW
OpenGL Syntax Functions have prefix gl and initial capital letters for each word glclearcolor(), glenable(), glpushmatrix() glu for GLU functions glulookat(), gluperspective() constants begin with GL_,
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 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 351-50 Graphics API ( Application Programming Interface) Software library Layer between programmer and graphics hardware (and other software
More informationCSE 167: Introduction to Computer Graphics Lecture #9: Visibility. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018
CSE 167: Introduction to Computer Graphics Lecture #9: Visibility Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018 Announcements Midterm Scores are on TritonEd Exams to be
More informationCS452/552; EE465/505. Models & Viewing
CS452/552; EE465/505 Models & Viewing 2-03 15 Outline! Building Polygonal Models Vertex lists; gl.drawarrays( ) Edge lists: gl.drawelements( )! Viewing Classical Viewing Read: Viewing in Web3D Angel, Section
More information11/1/13. Basic Graphics Programming. Teaching Assistant. What is OpenGL. Course Producer. Where is OpenGL used. Graphics library (API)
CSCI 420 Computer Graphics Lecture 2 Basic Graphics Programming Teaching Assistant Yijing Li Office hours TBA Jernej Barbic University of Southern California Graphics Pipeline OpenGL API Primitives: Lines,
More informationCSE 167: Lecture #4: Vertex Transformation. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012
CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Project 2 due Friday, October 12
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 informationS U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T
S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T Copyright 2018 Sung-eui Yoon, KAIST freely available on the internet http://sglab.kaist.ac.kr/~sungeui/render
More informationComputer Graphics CS 543 Lecture 4 (Part 2) Building 3D Models (Part 2)
Computer Graphics CS 543 Lecture 4 (Part 2) Building 3D Models (Part 2) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Modeling a Cube In 3D, declare vertices as (x,y,z)
More information