1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

1 View Shandong University Software College Instructor: Zhou Yuanfeng
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Projection Matrices Ed Angel
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Representation Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
OpenGL and Projections
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Computer Graphics (fall 2009)
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 E. Angel and D. Shreiner : Interactive Computer Graphics 6E © Addison-Wesley 2012 Classical Viewing Sai-Keung Wong ( 黃世強 ) Computer Science National.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 67 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 67 Computer Graphics Three-Dimensional Graphics III.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Demetriou/Loizidou – ACSC330 – Chapter 5 Viewing Dr. Giorgos A. Demetriou Computer Science Frederick Institute of Technology.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Computer Graphics I, Fall 2010 Computer Viewing.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Graphics CSCI 343, Fall 2015 Lecture 16 Viewing I
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Viewing and Projection
Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Emeritus of Computer Science University of New Mexico.
Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Emeritus of Computer Science University of New Mexico.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CS5500 Computer Graphics March 20, Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Computer Viewing Isaac Gang University of Mary Hardin-Baylor.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Introduction to Computer Graphics with WebGL
Viewing.
Computer Viewing.
Isaac Gang University of Mary Hardin-Baylor
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
CSC461: Lecture 19 Computer Viewing
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
University of New Mexico
Viewing (Projections)
Computer Graphics Computer Viewing
Computer Viewing Ed Angel Professor Emeritus of Computer Science
Introduction to Computer Graphics with WebGL
Presentation transcript:

1 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 Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

2 Computer Viewing Positioning the Camera Ed Angel Professor Emeritus of Computer Science University of New Mexico Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

3 Objectives Introduce the mathematics of projection Introduce WebGL viewing functions in MV.js Look at alternate viewing APIs Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

From the Beginning In the beginning: ­fixed function pipeline ­Model-View and Projection Transformation ­Predefined frames: model, object, camera, clip, ndc, window After deprecation ­pipeline with programmable shaders ­no transformations ­clip, ndc window frames MV.js reintroduces original capabilities 4 Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

5 Computer Viewing There are three aspects of the viewing process, all of which are implemented in the pipeline, ­Positioning the camera Setting the model-view matrix ­Selecting a lens Setting the projection matrix ­Clipping Setting the view volume Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

6 The WebGL Camera In WebGL, initially the object and camera frames are the same ­Default model-view matrix is an identity The camera is located at origin and points in the negative z direction WebGL also specifies a default view volume that is a cube with sides of length 2 centered at the origin ­Default projection matrix is an identity Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

7 Default Projection Default projection is orthogonal clipped out z=0 2 Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

8 Moving the Camera Frame If we want to visualize objects with both positive and negative z values we can either ­Move the camera in the positive z direction Translate the camera frame ­Move the objects in the negative z direction Translate the world frame Both of these views are equivalent and are determined by the model-view matrix ­Want a translation ( translate(0.0,0.0,-d); ) ­d > 0 Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

9 Moving Camera back from Origin default frames frames after translation by –d d > 0 Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

10 Moving the Camera We can move the camera to any desired position by a sequence of rotations and translations Example: side view ­Rotate the camera ­Move it away from origin ­Model-view matrix C = TR Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

11 WebGL code Remember that last transformation specified is first to be applied // Using MV.js var t = translate (0.0, 0.0, -d); var ry = rotateY(90.0); var m = mult(t, ry); or var m = mult(translate (0.0, 0.0, -d), rotateY(90.0);); Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

12 lookAt LookAt(eye, at, up) Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

13 The lookAt Function The GLU library contained the function gluLookAt to form the required modelview matrix through a simple interface Note the need for setting an up direction Replaced by lookAt() in MV.js ­Can concatenate with modeling transformations Example: isometric view of cube aligned with axes var eye = vec3(1.0, 1.0, 1.0); var at = vec3(0.0, 0.0, 0.0); var up = vec3(0.0, 1.0, 0.0); var mv = LookAt(eye, at, up); Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

14 Other Viewing APIs The LookAt function is only one possible API for positioning the camera Others include ­View reference point, view plane normal, view up (PHIGS, GKS-3D) ­Yaw, pitch, roll ­Elevation, azimuth, twist ­Direction angles Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015