Models and The Viewing Pipeline. Jian Huang CS456

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

Geometry: Outline. Projections. Orthographic Perspective

Projection and viewing. Computer Graphics CSE 167 Lecture 4

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

Viewing. Reading: Angel Ch.5

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

Chapter 8 Three-Dimensional Viewing Operations

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CS 4204 Computer Graphics

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

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

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

CSE452 Computer Graphics

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

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

CSE328 Fundamentals of Computer Graphics

Rasterization Overview

Overview. By end of the week:

COMP3421. Introduction to 3D Graphics

COMP3421. Introduction to 3D Graphics

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

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

CS 563 Advanced Topics in Computer Graphics Camera Models. by Kevin Kardian

Lecture 4. Viewing, Projection and Viewport Transformations

GEOMETRIC TRANSFORMATIONS AND VIEWING

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

INTRODUCTION TO COMPUTER GRAPHICS. It looks like a matrix Sort of. Viewing III. Projection in Practice. Bin Sheng 10/11/ / 52

OpenGL Transformations

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

Three-Dimensional Viewing Hearn & Baker Chapter 7

COMP3421. Introduction to 3D Graphics

Game Architecture. 2/19/16: Rasterization

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

Viewing with Computers (OpenGL)

Computer Graphics 7: Viewing in 3-D

INTRODUCTION TO COMPUTER GRAPHICS. cs123. It looks like a matrix Sort of. Viewing III. Projection in Practice 1 / 52

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

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

Drawing in 3D (viewing, projection, and the rest of the pipeline)

Rigid Body Motion and Image Formation. Jana Kosecka, CS 482

Last week. Machiraju/Zhang/Möller/Fuhrmann

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

Virtual Cameras and The Transformation Pipeline

Three Main Themes of Computer Graphics

1 OpenGL - column vectors (column-major ordering)

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

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

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM

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

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

For each question, indicate whether the statement is true or false by circling T or F, respectively.

Prof. Feng Liu. Fall /19/2016

Specifying Complex Scenes

COMS 4160: Problems on Transformations and OpenGL

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo)

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

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

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

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

Perspective transformations

THE VIEWING TRANSFORMATION

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

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

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

The Graphics Pipeline and OpenGL I: Transformations!

Rendering If we have a precise computer representation of the 3D world, how realistic are the 2D images we can generate? What are the best way to mode

Chapter 5. Projections and Rendering

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

UNIT 2 2D TRANSFORMATIONS

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Computer Graphics. Ch 6. 3D Viewing

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

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

CMSC427 Final Practice v2 Fall 2017

Camera Calibration. Schedule. Jesus J Caban. Note: You have until next Monday to let me know. ! Today:! Camera calibration

CSC 305 The Graphics Pipeline-1

DD2423 Image Analysis and Computer Vision IMAGE FORMATION. Computational Vision and Active Perception School of Computer Science and Communication

Advanced Computer Graphics Transformations. Matthias Teschner

5HDOLVP7KURXJK6\QWKHVLV

Computer Graphics. Chapter 10 Three-Dimensional Viewing

Perspective Shadow Maps. Shadow Map Aliasing. in particular for large scenes shadow maps impossible for infinite scenes

3D Viewing. CS 4620 Lecture 8

Pipeline Operations. CS 4620 Lecture 14

CS 543: Computer Graphics. Projection

CS488. Implementation of projections. Luc RENAMBOT

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

CS464 Oct 3 rd Assignment 3 Due 10/6/2017 Due 10/8/2017 Implementation Outline

Three-Dimensional Graphics III. Guoying Zhao 1 / 67

CS 418: Interactive Computer Graphics. Projection

Viewing transformations. 2004, Denis Zorin

CS6670: Computer Vision

CS451Real-time Rendering Pipeline

Computer Vision CS 776 Fall 2018

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

Drawing in 3D (viewing, projection, and the rest of the pipeline)

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

Perspective Mappings. Contents

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S

Clipping and Scan Conversion

Projections and Hardware Rendering. Brian Curless CSE 557 Fall 2014

Transcription:

Models and The Viewing Pipeline Jian Huang CS456

Vertex coordinates list, polygon table and (maybe) edge table Auxiliary: Per vertex normal Neighborhood information, arranged with regard to vertices and edges Polygon Mesh

Transformations Need? Modeling transformations build complex models by positioning simple components Viewing transformations placing virtual camera in the world transformation from world coordinates to eye coordinates Animation: vary transformations over time to create motion OBJECT EYE WORLD

Viewing Pipeline Object Space World Space Eye Space Clipping Space Canonical view volume Screen Space Object space: coordinate space where each component is defined World space: all components put together into the same 3D scene via affine transformation. (camera, lighting defined in this space) Eye space: camera at the origin, view direction coincides with the z axis. Hither and Yon planes perpendicular to the z axis Clipping space: do clipping here. All point is in homogeneous coordinate, i.e., each point is represented by (x,y,z,w) 3D image space (Canonical view volume): a parallelpipied shape defined by (-1:1,-1:1,0,1). Objects in this space is distorted Screen space: x and y coordinates are screen pixel coordinates

Object Space and World Space: Spaces Eye-Space:

Spaces Clip Space: Image Space:

2D Transformation Translation Rotation

Homogeneous Coordinates Matrix/Vector format for translation:

Translation in Homogenous Coordinates There exists an inverse mapping for each function There exists an identity mapping

Why these properties are important when these conditions are shown for any class of functions it can be proven that such a class is closed under composition i. e. any series of translations can be composed to a single translation.

Rotation in Homogeneous Space The two properties still apply.

Putting Translation and Rotation Order matters!! Together

Affine Transformation Property: preserving parallel lines The coordinates of three corresponding points uniquely determine any Affine Transform!!

Affine Transformations Translation Rotation Scaling Shearing T

How to determine an Affine 2D Transformation? We set up 6 linear equations in terms of our 6 unknowns. In this case, we know the 2D coordinates before and after the mapping, and we wish to solve for the 6 entries in the affine transform matrix

Affine Transformation in 3D Translation Rotate Scale Shear

More Rotation Which axis of rotation is this?

Viewing Object space to World space: affine transformation World space to Eye space: how? Eye space to Clipping space involves projection and viewing frustum

Perspective Projection Image F W I World Projection point sees anything on ray through pinhole F Point W projects along the ray through F to appear at I (intersection of WF with image plane)

Image Formation Image F World Projecting shapes project points onto image plane lines are projected by projecting its end points only

focal point at infinity Orthographic Projection rays are parallel and orthogonal to the image plane Image W F I World World Image F

Comparison

Simple Perspective Camera camera looks along z-axis focal point is the origin image plane is parallel to xy-plane at distance d d is call focal length for historical reason

Similar Triangles Y [Y, Z] [(d/z)y, d] [0, 0] [0, d] Z Similar situation with x-coordinate Similar Triangles: point [x,y,z] projects to [(d/z)x, (d/z)y, d]

Projection Matrix Projection using homogeneous coordinates: transform [x, y, z] to [(d/z)x, (d/z)y, d] é d 0 0 0ù é xù ê ú ê ú ê 0 d 0 0ú ê yú é ê ê 0 0 d 0ú ê ú zú = [ dx dy dz z] Þ d ê ú z x d ë ê z y ë ê 0 0 1 0û ú ë ê 1û ú Divide by 4th coordinate (the w coordinate) 2-D image point: discard third coordinate apply viewport transformation to obtain physical pixel coordinates d ù û ú

View Volume Defines visible region of space, pyramid edges are clipping planes Frustum :truncated pyramid with near and far clipping planes Near (Hither) plane? Don t care about behind the camera Far (Yon) plane, define field of interest, allows z to be scaled to a limited fixed-point value for z-buffering.

Difficulty It is difficult to do clipping directly in the viewing frustum

Canonical View Volume Normalize the viewing frustum to a cube, canonical view volume Converts perspective frustum to orthographic frustum perspective transformation

Perspective Transform The equations alpha = yon/(yon-hither) beta = yon*hither/(hither - yon) s: size of window on the image plane z 1 yon hither alpha z

About Perspective Transform Some properties

About Perspective Transform Clipping can be performed against the rectilinear box Planarity and linearity are preserved Angles and distances are not preserved Side effects: objects behind the observer are mapped to the front. Do we care?

Perspective + Projection Matrix AR: aspect ratio correction, ResX/ResY s= ResX, Theta: half view angle, tan(theta) = s/d

Camera Control and Viewing Focal length (d), image size/shape and clipping planes included in perspective transformation r Angle or Field of view (FOV) AR Aspect Ratio of view-port Hither, Yon Nearest and farthest vision limits (WS). Lookat - coi Lookfrom - eye View angle - FOV

Complete Perspective Specify near and far clipping planes - transform z between znear and zfar on to a fixed range Specify field-of-view (fov) angle OpenGL s glfrustum and gluperspective do these

More Viewing Parameters Camera, Eye or Observer: lookfrom:location of focal point or camera lookat: point to be centered in image Camera orientation about the lookat-lookfrom axis vup: a vector that is pointing straight up in the image. This is like an orientation.

Implementation Full Blown Translate by -lookfrom, bring focal point to origin Rotate lookat-lookfrom to the z-axis with matrix R: v = (lookat-lookfrom) (normalized) and z = [0,0,1] rotation axis: a = (vxz)/ vxz rotation angle: cosq = a z and sinq = rxz OpenGL: glrotate(q, a x, a y, a z ) Rotate about z-axis to get vup parallel to the y-axis

Viewport mapping Change from the image coordinate system (x,y,z) to the screen coordinate system (X,Y). Screen coordinates are always non-negative integers. Let (v r,v t ) be the upper-right corner and (v l,v b ) be the lower-left corner. X = x * (v r -v l )/2 + (v r +v l )/2 Y = y * (v t -v b )/2 + (v t +v b )/2

True Or False In perspective transformation parallelism is not preserved. Parallel lines converge Object size is reduced by increasing distance from center of projection Non-uniform foreshortening of lines in the object as a function of orientation and distance from center of projection Aid the depth perception of human vision, but shape is not preserved

True Or False Affine transformation is a combination of linear transformations The last column/row in the general 4x4 affine transformation matrix is [0 0 0 1] T. After affine transform, the homogeneous coordinate w maintains unity.