3D Viewing. CS 4620 Lecture 8

Similar documents
3D Viewing. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 9

Graphics 2009/2010, period 1. Lecture 6: perspective projection

CSC 305 The Graphics Pipeline-1

CS 4204 Computer Graphics

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

Lecture 4. Viewing, Projection and Viewport Transformations

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

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

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

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

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

CSE528 Computer Graphics: Theory, Algorithms, and Applications

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

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

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

CSE328 Fundamentals of Computer Graphics

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

Three-Dimensional Viewing Hearn & Baker Chapter 7

Overview. By end of the week:

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

Projection and viewing. Computer Graphics CSE 167 Lecture 4

Rasterization Overview

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

09 - Designing Surfaces. CSCI-GA Computer Graphics - Fall 16 - Daniele Panozzo

Geometric Transformations

2D/3D Geometric Transformations and Scene Graphs

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

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

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

Viewing with Computers (OpenGL)

CS6670: Computer Vision

Shadows in the graphics pipeline

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

Perspective transformations

Computer Vision Projective Geometry and Calibration. Pinhole cameras

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)

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

COMP3421. Introduction to 3D Graphics

Pipeline Operations. CS 4620 Lecture 14

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

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

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

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

Chapter 5. Projections and Rendering

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

Introduction to Computer Graphics 4. Viewing in 3D

COMP3421. Introduction to 3D Graphics

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

3D Viewing Episode 2

1 Projective Geometry

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

Vector Algebra Transformations. Lecture 4

Transforms 3: Projection Christian Miller CS Fall 2011

CS 4620 Midterm 1. Tuesday 22 October minutes

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

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

Prof. Feng Liu. Fall /19/2016

CS4620/5620. Professor: Kavita Bala. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

Fondamenti di Grafica 3D The Rasterization Pipeline.

COMP30019 Graphics and Interaction Perspective Geometry

Models and The Viewing Pipeline. Jian Huang CS456

COMP3421. Introduction to 3D Graphics

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

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading:

Viewing and Ray Tracing. CS 4620 Lecture 4

COMP3421. Vector geometry, Clipping

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

CS251 Spring 2014 Lecture 7

Viewing and Ray Tracing

Lecture 4: 3D viewing and projections

Viewing COMPSCI 464. Image Credits: Encarta and

Linear and Affine Transformations Coordinate Systems

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

The Graphics Pipeline and OpenGL I: Transformations!

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting

Game Architecture. 2/19/16: Rasterization

CS4620/5620: Lecture 14 Pipeline

CHAPTER 3. Single-view Geometry. 1. Consequences of Projection

Pipeline Operations. CS 4620 Lecture 10

The Graphics Pipeline and OpenGL I: Transformations!

Graphics Pipeline 2D Geometric Transformations

2D Spline Curves. CS 4620 Lecture 18

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

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

CS Exam 1 Review Problems Fall 2017

Culling. Computer Graphics CSE 167 Lecture 12

Graphics pipeline and transformations. Composition of transformations

Virtual Cameras and The Transformation Pipeline

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

COSC579: Scene Geometry. Jeremy Bolton, PhD Assistant Teaching Professor

CS 4620 Program 3: Pipeline

Computer Graphics I Lecture 11

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

Augmented Reality II - Camera Calibration - Gudrun Klinker May 11, 2004

2D Spline Curves. CS 4620 Lecture 13

Ray Tracing. CPSC 453 Fall 2018 Sonny Chan

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

CIS 580, Machine Perception, Spring 2016 Homework 2 Due: :59AM

Affine Transformations in 3D

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

Transcription:

3D Viewing CS 46 Lecture 8 13 Steve Marschner 1

Viewing, backward and forward So far have used the backward approach to viewing start from pixel ask what part of scene projects to pixel explicitly construct the ray corresponding to the pixel Next will look at the forward approach start from a point in 3D compute its projection into the image Central tool is matrix transformations combines seamlessly with coordinate transformations used to position camera and model ultimate goal: single matrix operation to map any 3D point to its correct screen location. 13 Steve Marschner

Forward viewing Would like to just invert the ray generation process Problem 1: ray generation produces rays, not points in scene Inverting the ray tracing process requires division for the perspective case 13 Steve Marschner 3

Mathematics of projection Always work in eye coords assume eye point at and plane perpendicular to z Orthographic case a simple projection: just toss out z Perspective case: scale diminishes with z and increases with d 13 Steve Marschner 4

Pipeline of transformations Standard sequence of transforms object space camera space screen space modeling transformation camera transformation projection transformation viewport transformation world space canonical view volume 13 Steve Marschner 5

Parallel projection: orthographic to implement orthographic, just toss out z: 13 Steve Marschner 6

View volume: orthographic 13 Steve Marschner 7

Viewing a cube of size Start by looking at a restricted case: the canonical view volume It is the cube [ 1,1] 3, viewed from the z direction Matrix to project it into a square image in [ 1,1] is trivial: 1 1 1 13 Steve Marschner 8

Viewing a cube of size To draw in image, need coordinates in pixel units, though Exactly the opposite of mapping (i,j) to (u,v) in ray generation 1 ny.5 1 1.5 1.5 nx.5 13 Steve Marschner 9

Windowing transforms This transformation is worth generalizing: take one axis-aligned ( ) rectangle or box to another (x l, y l ) a useful, if mundane, piece of a transformation chain (x h, y h ) 1 x x h x l l x 1 y l h x l 1 x l y h y l y h y l 1 y l 1 1 1 (x h x l, y h y l ) (x h x l, y h y l ) (x h, y h ) x h x l x h x l y h y l y h y l x l x h x h x l x h x l y l y h y h y l y h y l 1 (x l, y l ) [Shirley3e f. 6-16; eq. 6-6] 13 Steve Marschner 1

Viewport transformation 1 ny.5 1 1.5 1.5 nx.5 x screen y screen = 1 n x n y n x 1 n y 1 1 x canonical y canonical 1 13 Steve Marschner 11

Viewport transformation In 3D, carry along z for the ride one extra row and column M vp = n x n x 1 n y 1 n y 1 1 13 Steve Marschner 1

Orthographic projection First generalization: different view rectangle retain the minus-z view direction specify view by left, right, top, bottom (as in RT) also near, far 13 Steve Marschner 13

Clipping planes In object-order systems we always use at least two clipping planes that further constrain the view volume near plane: parallel to view plane; things between it and the viewpoint will not be rendered far plane: also parallel; things behind it will not be rendered These planes are: partly to remove unnecessary stuff (e.g. behind the camera) but really to constrain the range of depths (we ll see why later) 13 Steve Marschner 14

Orthographic projection We can implement this by mapping the view volume to the canonical view volume. This is just a 3D windowing transformation! x h x l M orth = x h x l y h y l y h y l z h z l z h z l x l x h x h x l x h x l y l y h y h y l y h y l z l z h z h z l z h z l 1 r+l r l r l t+b t b t b n+f n f n f 1 13 Steve Marschner 15

Camera and modeling matrices We worked out all the preceding transforms starting from eye coordinates before we do any of this stuff we need to transform into that space Transform from world (canonical) to eye space is traditionally called the viewing matrix it is the canonical-to-frame matrix for the camera frame that is, F c 1 Remember that geometry would originally have been in the object s local coordinates; transform into world coordinates is called the modeling matrix, M m Note many programs combine the two into a modelview matrix and just skip world coordinates 13 Steve Marschner 16

Viewing transformation the camera matrix rewrites all coordinates in eye space 13 Steve Marschner 17

Orthographic transformation chain Start with coordinates in object s local coordinates Transform into world coords (modeling transform, M m ) Transform into eye coords (camera xf., M cam = F c 1 ) Orthographic projection, M orth Viewport transform, M vp p s = M vp M orth M cam M m p o x s y s z c 1 = n x n x 1 n y 1 n y 1 1 r+l r l r l t+b t b t b n+f n f n f 1 u v w e 1 1 M m x o y o z o 1 13 Steve Marschner 18

Perspective projection similar triangles: 13 Steve Marschner 19

Homogeneous coordinates revisited Perspective requires division that is not part of affine transformations in affine, parallel lines stay parallel therefore not vanishing point therefore no rays converging on viewpoint True purpose of homogeneous coords: projection 13 Steve Marschner

Homogeneous coordinates revisited Introduced w = 1 coordinate as a placeholder used as a convenience for unifying translation with linear Can also allow arbitrary w 13 Steve Marschner 1

Implications of w All scalar multiples of a 4-vector are equivalent When w is not zero, can divide by w therefore these points represent normal affine points When w is zero, it s a point at infinity, a.k.a. a direction this is the point where parallel lines intersect can also think of it as the vanishing point Digression on projective space 13 Steve Marschner

Perspective projection to implement perspective, just move z to w: 13 Steve Marschner 3

View volume: perspective 13 Steve Marschner 4

View volume: perspective (clipped) 13 Steve Marschner 5

Carrying depth through perspective Perspective has a varying denominator can t preserve depth! Compromise: preserve depth on near and far planes that is, choose a and b so that z (n) = n and z (f) = f. 13 Steve Marschner 6

Official perspective matrix Use near plane distance as the projection distance i.e., d = n Scale by 1 to have fewer minus signs scaling the matrix does not change the projective transformation n P = n n + f fn 1 13 Steve Marschner 7

Perspective projection matrix Product of perspective matrix with orth. projection matrix M per = M orth P r+l r l r l n t+b t b t b = n+f n n + f fn n f n f 1 1 = n l+r r l l r n t b b+t b t f+n n f fn f n 1 13 Steve Marschner 8

x s y s z c 1 Perspective transformation chain Transform into world coords (modeling transform, M m ) Transform into eye coords (camera xf., M cam = F c 1 ) Perspective matrix, P Orthographic projection, M orth Viewport transform, M vp = n x p s = M vp M orth PM cam M m p o n x 1 n y 1 n y 1 1 r+l r l r l t+b t b t b n+f n f n f 1 n n n + f fn 1 M camm m x o y o z o 1 13 Steve Marschner 9

Pipeline of transformations Standard sequence of transforms object space camera space screen space modeling transformation camera transformation projection transformation viewport transformation world space canonical view volume 13 Steve Marschner 3