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

Similar documents
3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

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

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

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

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

Geometry: Outline. Projections. Orthographic Perspective

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

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

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

Introduction to Computer Graphics 4. Viewing in 3D

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

2D transformations: An introduction to the maths behind computer graphics

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

Three-Dimensional Graphics III. Guoying Zhao 1 / 67

COMP30019 Graphics and Interaction Perspective Geometry

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

Lecture 4: Viewing. Topics:

Computer Graphics. Chapter 10 Three-Dimensional Viewing

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

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

Transforms 3: Projection Christian Miller CS Fall 2011

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

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

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

Chapter 8 Three-Dimensional Viewing Operations

Viewing and Projection

Computer Graphics. Jeng-Sheng Yeh 葉正聖 Ming Chuan University (modified from Bing-Yu Chen s slides)

COMP30019 Graphics and Interaction Perspective & Polygonal Geometry

Computer Viewing Computer Graphics I, Fall 2008

CS 4204 Computer Graphics

Overview. By end of the week:

Viewing. Reading: Angel Ch.5

Viewing and Projection

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

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

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

Fundamental Types of Viewing

Three-Dimensional Viewing Hearn & Baker Chapter 7

CSE528 Computer Graphics: Theory, Algorithms, and Applications

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

Computer Graphics 7: Viewing in 3-D

Chapter 5. Projections and Rendering

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

5.8.3 Oblique Projections

Viewing/Projections IV. Week 4, Fri Feb 1

Viewing with Computers (OpenGL)

Advanced Computer Graphics (CS & SE )

3.1 Viewing and Projection

Lecture 4. Viewing, Projection and Viewport Transformations

CSE328 Fundamentals of Computer Graphics

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

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

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

3D Graphics Pipeline II Clipping. Instructor Stephen J. Guy

Prof. Feng Liu. Fall /19/2016

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

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

MAE : Lecture #12 - Projection and Perspective. Lecture Overview:

2D and 3D Viewing Basics

CSC 470 Computer Graphics. Three Dimensional Viewing

CSC 470 Computer Graphics

OpenGL Transformations

So we have been talking about 3D viewing, the transformations pertaining to 3D viewing. Today we will continue on it. (Refer Slide Time: 1:15)

GRAFIKA KOMPUTER. ~ M. Ali Fauzi

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

Viewing Transformation

Models and The Viewing Pipeline. Jian Huang CS456

Projections. Brian Curless CSE 457 Spring Reading. Shrinking the pinhole. The pinhole camera. Required:

Fachhochschule Regensburg, Germany, February 15, 2017

3D Viewing. CS 4620 Lecture 8

Computer Graphics. Chapter 7 2D Geometric Transformations

Viewing and Projection Transformations

Viewing and Projection

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

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

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

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

Lecture 4 of 41. Lab 1a: OpenGL Basics

Lecture 5: Viewing. CSE Computer Graphics (Fall 2010)

Projection Lecture Series

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

Viewing COMPSCI 464. Image Credits: Encarta and

CS 418: Interactive Computer Graphics. Projection

CS 591B Lecture 9: The OpenGL Rendering Pipeline

CS 543: Computer Graphics. Projection

Rasterization Overview

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

3D Viewing Episode 2

Chap 7, 2008 Spring Yeong Gil Shin

1 (Practice 1) Introduction to OpenGL

COMP3421. Introduction to 3D Graphics

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Realtime 3D Computer Graphics & Virtual Reality. Viewing

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

CIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011

COMS 4160: Problems on Transformations and OpenGL

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

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. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 9

Transcription:

Overview of Projections: From a 3D world to a 2D screen. Lecturer: Dr Dan Cornford d.cornford@aston.ac.uk http://wiki.aston.ac.uk/dancornford CS2150, Computer Graphics, Aston University, Birmingham, UK http://wiki.aston.ac.uk/c2150 October 26, 2009 Dan Cornford 3D to 2D 1/18

Outline: 3D to 2D Projection in computer graphics. Types of projection. Viewing in OpenGL. Dan Cornford 3D to 2D 2/18

Projection Gets a bit mathematical (but not for a while). Central to computer graphics. 3D world coordinate output primitives Clip against view volume Project onto projection plane Transform to 2D device coordinates 2D device coordinates For now we will focus on the 3D to 2D part - transforming to device coordinates is relatively simple! Dan Cornford 3D to 2D 3/18

General projections projection plane A projection plane C A* B C* D projectors B* projectors D* centre of projection to infinity Perspective foreshortening is important to realism but results in distortion of angles, distances and parallel lines. Parallel projections also distort angles, but maintain parallelism and distances. Dan Cornford 3D to 2D 4/18

General projections Convert an nd coordinate system into a md coordinate system: in computer graphics 3D 2D. We consider planar geometric projections we project onto a plane. Projections can be visualised using projectors which emanate from the centre of the projection. The centre of projection is generally at a finite distance from the projection plane but is sometimes defined at infinity (parallel projections). Easy to implement (if not understand) using homogeneous coordinates. Dan Cornford 3D to 2D 5/18

Defining a plane? We need to define the projection plane how can this be done? projection plane A projection plane C A* B C* D projectors B* projectors D* centre of projection to infinity Dan Cornford 3D to 2D 6/18

Defining a plane? Most simple: define a point in the projection plane, and then two vectors, one for up and one for across. This allows us to define any (all) points in the plane. For computer graphics we normally give a point, a vector to define up and a normal vector to the plane (which is the cross product of the up and across vectors). Concept of normal vectors is very important in computer graphics. From Wikipedia Dan Cornford 3D to 2D 7/18

Perspective projections y Projection plane Center of projection z x Projection plane normal In a perspective projection all parallel lines that are not parallel to the projection plane appear to go to a vanishing point. Dan Cornford 3D to 2D 8/18

2 point perspective projections y Projection plane z x x-axis vanishing point z-axis vanishing point Center of projection The number of axis vanishing points will depend on the number of axes cut by the projection plane two point projections look realistic. Dan Cornford 3D to 2D 9/18

Parallel projections Parallel orthographic projections have the direction of the projection parallel to the normal to the projection plane: Projectors for top view Projection plane (top view) Projectors for side view Projection plane (front view) Projectors for front view Projection plane (side view) Dan Cornford 3D to 2D 10/18

Parallel projections Axonometric orthographic projections are parallel projections that use projection planes that are not normal to the principal axes. Projection plane y Projector Projectionplane normal x z Dan Cornford 3D to 2D 11/18

Parallel projections In oblique projection the projection plane normal and direction of projection differ. Projection plane y z Projector x Projection-plane normal This is quite unrealistic and not often used. Dan Cornford 3D to 2D 12/18

Viewing in OpenGL OpenGL viewing definition uses the camera analogy. Two matrices define the total projection: GL PROJECTION defines the projection using the matrices: MS per H par as given in the notes. Define the viewing window (x min, y min and x max, y max ), and the near and far clipping planes. Think of this like the lens of a camera. From glprogramming.com Use the command glfrustum to set the viewing / projection parameters. Dan Cornford 3D to 2D 13/18

Viewing in OpenGL The other matrix to set is the GL MODELVIEW matrix which controls both the objects and the view. This is like the matrices S par T par as given in the notes. Think of this like aiming the camera. From glprogramming.com Use glulookat with the eye, location to look at and up vectors to define the camera. Dan Cornford 3D to 2D 14/18

Practical viewing in OpenGL Easy to get lost in space: keep the far clipping plane to a large value changing the near clipping plane changes the degree of perspective distortion. Use asymmetric (x min, y min and x max, y max ) to achieve false perspective make VPN non-parallel to DOP. Start with a large front clipping plane: (x min, y min and x max, y max ) then focus in on the object. Set the viewport using glviewport and give the origin and width / height (keep the same as the aspect ratio of the front clipping plane. If it ain t broke don t fix it! Dan Cornford 3D to 2D 15/18

Viewing in OpenGL The OpenGL viewing pipeline looks like: x y z w World Coordinates model view matrix Eye Coordinates projection matrix perspective division /w Clip Coordinates Canonical View Volume window to viewport x y Screen Coordinates For both projection and model view matrices use glmatrixmode to define which to use and then don t forget to initialise them using glloadidentity. In the labs most of this is handled for you by the graphicslab class. From OpenGL tutors Dan Cornford 3D to 2D 16/18

Viewing in OpenGL Can also use parallel projections: use glortho to set the projection matrix. The model view matrix is set in the same way as before. Use glloadmatrix to define our own projection matrices (masochists only). Beware the difference between modelling and viewing transformations there is none in the code! Viewing transformations are always set first in the code, since they are applied last to all objects in the animated models. Dan Cornford 3D to 2D 17/18

Summary Having finished this lecture you should: understand what projection is in computer graphics; compare perspective and parallel projections; understand the applications of the different types of projections; define appropriate projections in OpenGL. We will look next at how projection is handled mathematically! Dan Cornford 3D to 2D 18/18