Introduction to Computer Graphics with WebGL

Similar documents
Computer Viewing Computer Graphics I, Fall 2008

Computer Viewing. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Announcement. Project 1 has been posted online and in dropbox. Due: 11:59:59 pm, Friday, October 14

3D Viewing. With acknowledge to: Ed Angel. Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Classical and Computer Viewing. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Computer Viewing. CITS3003 Graphics & Animation. E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley

One or more objects A viewer with a projection surface Projectors that go from the object(s) to the projection surface

3D Viewing. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

3D Viewing. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Building Models. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Computer Viewing and Projection. Overview. Computer Viewing. David Carr Fundamentals of Computer Graphics Spring 2004 Based on Slides by E.

Introduction to Computer Graphics with WebGL

Overview. Viewing and perspectives. Planar Geometric Projections. Classical Viewing. Classical views Computer viewing Perspective normalization

CS452/552; EE465/505. Review & Examples

CS452/552; EE465/505. Models & Viewing

CS354 Computer Graphics Viewing and Modeling

Transformations. Rotation and Scaling

Three-Dimensional Graphics III. Guoying Zhao 1 / 67

Introduction to Computer Graphics with WebGL

CS 432 Interactive Computer Graphics

Computer Graphics (CS 543) Lecture 6a: Viewing & Camera Control. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Introduction to Computer Graphics with WebGL

Viewing with Computers (OpenGL)

Transformations II. Arbitrary 3D Rotation. What is its inverse? What is its transpose? Can we constructively elucidate this relationship?

Viewing and Modeling

Introduction to Computer Graphics with WebGL

CS452/552; EE465/505. Transformations

Overview. By end of the week:

COMS 4160: Problems on Transformations and OpenGL

Computer Viewing. Prof. George Wolberg Dept. of Computer Science City College of New York

GEOMETRIC TRANSFORMATIONS AND VIEWING

Fachhochschule Regensburg, Germany, February 15, 2017

Introduction to Computer Graphics with WebGL

2D and 3D Viewing Basics

Lecture 5: Transforms II. Computer Graphics and Imaging UC Berkeley CS184/284A

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1

Transforms 3: Projection Christian Miller CS Fall 2011

Introduction to Computer Graphics 4. Viewing in 3D

The Importance of Matrices in the DirectX API. by adding support in the programming language for frequently used calculations.

Viewing and Projection Transformations

Chapter 8 Three-Dimensional Viewing Operations

Models and Architectures

Virtual Cameras & Their Matrices

Transformations. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

CS 543: Computer Graphics Lecture 6 (Part I): 3D Viewing and Camera Control. Emmanuel Agu

The Graphics Pipeline and OpenGL I: Transformations!

Three-Dimensional Viewing Hearn & Baker Chapter 7

Visualisation Pipeline : The Virtual Camera

3.1 Viewing and Projection

Viewing and Projection

3D Viewing Episode 2

Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009

Viewing and Projection

3D Viewing Episode 2

Chap 3 Viewing Pipeline Reading: Angel s Interactive Computer Graphics, Sixth ed. Sections 4.1~4.7

Geometry: Outline. Projections. Orthographic Perspective

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

GLOBAL EDITION. Interactive Computer Graphics. A Top-Down Approach with WebGL SEVENTH EDITION. Edward Angel Dave Shreiner

Chapter 5. Projections and Rendering

Fundamental Types of Viewing

Computer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

CS452/552; EE465/505. Intro to Lighting

CITSTUDENTS.IN VIEWING. Computer Graphics and Visualization. Classical and computer viewing. Viewing with a computer. Positioning of the camera

Announcements. Submitting Programs Upload source and executable(s) (Windows or Mac) to digital dropbox on Blackboard

Viewing. Reading: Angel Ch.5

The Graphics Pipeline and OpenGL I: Transformations!

3D Viewing Transformations

Transformation Pipeline

Autonomous Navigation for Flying Robots

Reminder: Affine Transformations. Viewing and Projection. Shear Transformations. Transformation Matrices in OpenGL. Specification via Ratios

Computer Graphics CS 543 Lecture 5 (Part 2) Implementing Transformations

Lecture 4. Viewing, Projection and Viewport Transformations

5.8.3 Oblique Projections

Models and Architectures. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

COMP3421. Introduction to 3D Graphics

Overview. By end of the week:

We will use WebGL 1.0. WebGL 2.0 is now being supported by most browsers but requires a better GPU so may not run on older computers or on most cell

Computer Graphics. Chapter 10 Three-Dimensional Viewing

COMP3421. Introduction to 3D Graphics

Viewing transformations. 2004, Denis Zorin

To Do. Outline. Translation. Homogeneous Coordinates. Foundations of Computer Graphics. Representation of Points (4-Vectors) Start doing HW 1

Describe the Orthographic and Perspective projections. How do we combine together transform matrices?

Viewing. Cliff Lindsay, Ph.D. WPI

Graphics pipeline and transformations. Composition of transformations

3D Transformations. CS 4620 Lecture 10. Cornell CS4620 Fall 2014 Lecture Steve Marschner (with previous instructors James/Bala)

Overview of Projections: From a 3D world to a 2D screen.

Building Models. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

3D Transformations. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 11

Illumination & Shading I

Transformations. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Objectives. transformation. General Transformations. Affine Transformations. Notation. Pipeline Implementation. Introduce standard transformations

7. 3D Viewing. Projection: why is projection necessary? CS Dept, Univ of Kentucky

COMP Computer Graphics and Image Processing. a6: Projections. In part 2 of our study of Viewing, we ll look at. COMP27112 Toby Howard

Computer Graphics: Viewing in 3-D. Course Website:

CS251 Spring 2014 Lecture 7

The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes

Computer Graphics 7: Viewing in 3-D

Linear and Affine Transformations Coordinate Systems

CS380: Computer Graphics Viewing Transformation. Sung-Eui Yoon ( 윤성의 ) Course URL:

Transcription:

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 1

Computer Viewing Positioning the Camera Ed Angel Professor Emeritus of Computer Science University of New Mexico 2

Objectives Introduce the mathematics of projection Introduce WebGL viewing functions in MV.js Look at alternate viewing APIs 3

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

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 5

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 6

Default Projection Default projection is orthogonal 2 clipped out z=0 7

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 8

Moving Camera back from Origin default frames frames after translation by d d > 0 9

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 1 0

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);); 1 1

lookat LookAt(eye, at, up) 1 2

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); 1 3

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 1 4