Geometry: Outline. Projections. Orthographic Perspective

Similar documents
Computer Viewing Computer Graphics I, Fall 2008

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

COMS 4160: Problems on Transformations and OpenGL

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

COMP3421. Introduction to 3D Graphics

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

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

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

Getting Started. Overview (1): Getting Started (1): Getting Started (2): Getting Started (3): COSC 4431/5331 Computer Graphics.

Viewing Transformation

Models and The Viewing Pipeline. Jian Huang CS456

COMP3421. Introduction to 3D Graphics

3D Graphics for Game Programming (J. Han) Chapter II Vertex Processing

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

Three-Dimensional Graphics III. Guoying Zhao 1 / 67

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

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

Evening s Goals. Mathematical Transformations. Discuss the mathematical transformations that are utilized for computer graphics

Computer Graphics. Chapter 10 Three-Dimensional Viewing

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline

COMP3421. Introduction to 3D Graphics

2D and 3D Viewing Basics

Fundamental Types of Viewing

CS 4204 Computer Graphics

CS354 Computer Graphics Viewing and Modeling

The View Frustum. Lecture 9 Sections 2.6, 5.1, 5.2. Robb T. Koether. Hampden-Sydney College. Wed, Sep 14, 2011

CSE 167: Introduction to Computer Graphics Lecture #5: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

CSE 167: Lecture #4: Vertex Transformation. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

CIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011

Prof. Feng Liu. Fall /19/2016

Lecture 9 Sections 2.6, 5.1, 5.2. Wed, Sep 16, 2009

MORE OPENGL. Pramook Khungurn CS 4621, Fall 2011

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

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

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

Projection: Mapping 3-D to 2-D. Orthographic Projection. The Canonical Camera Configuration. Perspective Projection

CSC 470 Computer Graphics. Three Dimensional Viewing

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

Transforms 3: Projection Christian Miller CS Fall 2011

CS 543: Computer Graphics. Projection

CSC 470 Computer Graphics

Wire-Frame 3D Graphics Accelerator IP Core. C Library Specification

Viewing. Reading: Angel Ch.5

Introduction to Computer Graphics 4. Viewing in 3D

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

CS 428: Fall Introduction to. Viewing and projective transformations. Andrew Nealen, Rutgers, /23/2009 1

Spring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013

Viewing with Computers (OpenGL)

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

Projection and viewing. Computer Graphics CSE 167 Lecture 4

Precept 2 Aleksey Boyko February 18, 2011

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

Overview. By end of the week:

Computer Graphics. Basic 3D Programming. Contents

Viewing and Projection

Three-Dimensional Viewing Hearn & Baker Chapter 7

CS559: Computer Graphics. Lecture 12: OpenGL Transformation Li Zhang Spring 2008

Viewing and Projection

OpenGL Transformations

CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science

CSE528 Computer Graphics: Theory, Algorithms, and Applications

3.1 Viewing and Projection

Viewing COMPSCI 464. Image Credits: Encarta and

To Do. Demo (Projection Tutorial) Motivation. What we ve seen so far. Outline. Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 5: Viewing

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

Viewing. Announcements. A Note About Transformations. Orthographic and Perspective Projection Implementation Vanishing Points

To Do. Motivation. Demo (Projection Tutorial) What we ve seen so far. Computer Graphics. Summary: The Whole Viewing Pipeline

Fachhochschule Regensburg, Germany, February 15, 2017

CSE328 Fundamentals of Computer Graphics

Advanced Computer Graphics (CS & SE )

Motivation. What we ve seen so far. Demo (Projection Tutorial) Outline. Projections. Foundations of Computer Graphics

Game Architecture. 2/19/16: Rasterization

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

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

Computer Graphics. Bing-Yu Chen National Taiwan University

CSE452 Computer Graphics

CMSC427 Transformations II: Viewing. Credit: some slides from Dr. Zwicker

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

Transformations (Rotations with Quaternions) October 24, 2005

Lecture 4 of 41. Lab 1a: OpenGL Basics

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

Viewing. Part II (The Synthetic Camera) CS123 INTRODUCTION TO COMPUTER GRAPHICS. Andries van Dam 10/10/2017 1/31

Graphics and Visualization

Vision Review: Image Formation. Course web page:

COMP Computer Graphics and Image Processing. 5: Viewing 1: The camera. In part 1 of our study of Viewing, we ll look at ˆʹ U ˆ ʹ F ˆʹ S

Lecture 4. Viewing, Projection and Viewport Transformations

1 (Practice 1) Introduction to OpenGL

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

GRAFIKA KOMPUTER. ~ M. Ali Fauzi

The Graphics Pipeline and OpenGL I: Transformations!

CS 418: Interactive Computer Graphics. Projection

Computer Graphics. P05 Viewing in 3D. Part 1. Aleksandra Pizurica Ghent University

CS230 : Computer Graphics Lecture 6: Viewing Transformations. Tamar Shinar Computer Science & Engineering UC Riverside

Modeling Transform. Chapter 4 Geometric Transformations. Overview. Instancing. Specify transformation for objects 李同益

Viewing transformations. 2004, Denis Zorin

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

Transformation Pipeline

Chapter 5. Projections and Rendering

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

Computer Graphics. Lecture 04 3D Projection and Visualization. Edirlei Soares de Lima.

Transcription:

Geometry: Cameras Outline Setting up the camera Projections Orthographic Perspective 1

Controlling the camera Default OpenGL camera: At (0, 0, 0) T in world coordinates looking in Z direction with up vector (0, 1, 0) T Up vector controls camera roll (rotation around z-axis) Changing position: glulookat() eye = (eyex, eyey, eyez) T : Desired camera position = (X, Y, Z) T : Where camera is looking up = (upx, upy, upz) T : Camera s up vector from Woo et al. The Viewing Volume Definition: The region of 3-D space visible in the image Depends on: Camera position, orientation Field of view, image size Projection type Orthographic Perspective courtesy of N. Robins 2

glulookat(): Details To build the camera coordinate system, and find the rigid transformation between world system and camera system. Steps 1. Compute vectors u, v, n defining new camera axes in world coordinates 2. Compute location of old camera position in terms of new location s coordinate system 3. Fill in rigid transform matrix glulookat(): Axes Form basis vectors New camera Z axis: n = eye - New camera X axis: u = up x n New camera Y axis: v = n x u (not necessarily same as up) Normalize so that these are unit vectors 3

glulookat(): Axes Form basis vectors New camera Z axis: n = eye - New camera X axis: u = up x n New camera Y axis: v = n x u (not necessarily same as up) Normalize so that these are unit vectors glulookat(): Axes Form basis vectors New camera Z axis: n = eye - New camera X axis: u = up x n New camera Y axis: v = n x u (not necessarily same as up) Normalize so that these are unit vectors up 4

glulookat(): Axes Form basis vectors New camera Z axis: n = eye - New camera X axis: u = up x n New camera Y axis: v = n x u (not necessarily same as up) Normalize so that these are unit vectors glulookat(): Axes Form basis vectors New camera Z axis: n = eye - New camera X axis: u = up x n New camera Y axis: v = n x u (not necessarily same as up) Normalize so that these are unit vectors 5

glulookat(): Axes Form basis vectors New camera Z axis: n = eye - New camera X axis: u = up x n New camera Y axis: v = n x u (not necessarily same as up) Normalize so that these are unit vectors glulookat(): Axes Now make 3 x 3 rotation matrix from formula on rigid transform slide: Since, this is the same as: 6

glulookat(): Location : World origin in camera coordinates -eye origin glulookat(): Location : World origin in camera coordinates -eye is in world coordinates, so project on camera axes: -eye origin 7

glulookat(): Matrix Letting and writing the vector components as u = (u x, u y, u z ) T, etc., the final transformation matrix is given by: Transformations vs. Projections Transformation: Mapping within n-d space Moves points around, effectively warping space Projection: Mapping from n-d space down to lowerdimensional subspace E.g., point in 3-D space to point on plane (a 2-D entity) in that space We will be interested in such 3-D to 2-D projections where the plane is the image Parallel projection along direction d onto a plane 8

Parallel Projections Oblique: d in general position relative to plane normal n Orthographic: d parallel to n Orthographic Projection Projection direction d is aligned with Z axis Viewing volume is brick -shaped region in space Not the same as image size No perspective effects distant objects look same as near ones, so camera (x, y, z) => image (x, y) 9

Orthographic Projection in OpenGL Setting up the viewing volume (VV): glortho() left, right, bottom, top: Coordinates of sides of viewing volume znear, zfar: Distance to arbitrarily designated front, back sides of VV Negative = Behind camera gluortho2d(): glortho() with near = -1, far = 1 Modifies top 4 x 4 matrix of GL_PERSPECTIVE matrix stack Applied after GL_MODELVIEW transformation has put things in camera coordinates Actual matrix scales viewing volume (VV) to canonical VV (CVV): Cube extending from -1 to 1 along each dimension Perspective with a Pinhole Camera c from Forsyth & Ponce Instead of single direction d characteristic of parallel projections, rays emanating from single point c define perspective projection 10

Perspective Projection c from Forsyth & Ponce Perspective Projection: Viewing Volume Characteristic shape is a frustum a truncated pyramid 11

Perspective Projection: Properties Far objects appear smaller than near ones Lines are preserved Parallel lines in plane Π converge at infinity Pinhole Camera Terminology Principal plane Image plane Optical axis Focal length Image / Principal point Camera Image point Camera point 12

Perspective Projection Letting the camera coordinates of the projected point be leads by similar triangles to: Perspective Projection Matrix Using homogeneous coordinates, we can describe a perspective transformation with a 4 x 4 matrix multiplication: li (by the rule for converting between homogeneous and regular coordinates this is called the perspective division) Projection to (u, v) T is again accomplished by simply dropping the z coordinate 13

Perspective Projections in OpenGL glfrustum() sets transformation to CVV Arguments like glortho(), but znear, zfar must be positive from Woo et al. A final transform, GL_VIEWPORT (see glviewport()) shifts NDC to image coordinate origin and scales to fit window gluperspective() Simplifies call to glfrustum() Arguments: fovy: Field of view angle (degrees) in Y direction aspect: Ratio of width to height of viewing frustum near, far: Same as glfrustum() from Woo et al. 14