Chap 7, 2009 Spring Yeong Gil Shin

Similar documents
Chap 7, 2008 Spring Yeong Gil Shin

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

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

Lecture 4: Viewing. Topics:

What does OpenGL do?

Chapter 8 Three-Dimensional Viewing Operations

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Must first specify the type of projection desired. When use parallel projections? For technical drawings, etc. Specify the viewing parameters

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

Introduction to Computer Graphics 4. Viewing in 3D

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

Three-Dimensional Viewing Hearn & Baker Chapter 7

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

Realtime 3D Computer Graphics & Virtual Reality. Viewing

Transforms II. Overview. Homogeneous Coordinates 3-D Transforms Viewing Projections. Homogeneous Coordinates. x y z w

3-Dimensional Viewing

Two Dimensional Viewing

5.8.3 Oblique Projections

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

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

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

CS488. Implementation of projections. Luc RENAMBOT

Three-Dimensional Graphics III. Guoying Zhao 1 / 67

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

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

Viewing/Projection IV. Week 4, Fri Jan 29

Viewing. Reading: Angel Ch.5

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

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

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

CS 325 Computer Graphics

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

CS 475 / CS 675 Computer Graphics. Lecture 7 : The Modeling-Viewing Pipeline

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

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

Viewing/Projections IV. Week 4, Fri Feb 1

Viewing in 3D (Chapt. 6 in FVD, Chapt. 12 in Hearn & Baker)

Viewing and Projection

Viewing. Cliff Lindsay, Ph.D. WPI

Viewing/Projections III. Week 4, Wed Jan 31

CS 4731/543: Computer Graphics Lecture 5 (Part I): Projection. Emmanuel Agu

Computer Graphics 7: Viewing in 3-D

CPSC 314, Midterm Exam 1. 9 Feb 2007

Last Time. Correct Transparent Shadow. Does Ray Tracing Simulate Physics? Does Ray Tracing Simulate Physics? Refraction and the Lifeguard Problem

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Examples. Clipping. The Rendering Pipeline. View Frustum. Normalization. How it is done. Types of operations. Removing what is not seen on the screen

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

Today s class. Geometric objects and transformations. Informationsteknologi. Wednesday, November 7, 2007 Computer Graphics - Class 5 1

p =(x,y,d) y (0,0) d z Projection plane, z=d

Modeling Transformations

CSE328 Fundamentals of Computer Graphics

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

What and Why Transformations?

Overview. By end of the week:

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

Determining the 2d transformation that brings one image into alignment (registers it) with another. And

Realtime 3D Computer Graphics Virtual Reality

Computer Graphics Chapter 7 Three-Dimensional Viewing Viewing

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

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

CS Computer Graphics: Transformations & The Synthetic Camera

Modeling Transformations

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

Fundamental Types of Viewing

Chapter 5. Projections and Rendering

Viewing with Computers (OpenGL)

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

Viewing and Projection Transformations

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

Models and The Viewing Pipeline. Jian Huang CS456

CS 543: Computer Graphics. Projection

The 3-D Graphics Rendering Pipeline

COMP30019 Graphics and Interaction Perspective Geometry

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

COMP30019 Graphics and Interaction Perspective & Polygonal Geometry

1. We ll look at: Types of geometrical transformation. Vector and matrix representations

Projection Lecture Series

CS 4204 Computer Graphics

Computer Graphics. Chapter 10 Three-Dimensional Viewing

SE Mock Online Retest 2-CG * Required

Viewing Transformations I Comp 535

CS 351: Perspective Viewing

High Dimensional Rendering in OpenGL

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)

Computer Graphics. Geometric Transformations

3D Geometry and Camera Calibration

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

Homogeneous Coordinates

Scene Graphs & Modeling Transformations COS 426

Computer Graphics. Geometric Transformations

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

3D Viewing and Projec5on. Taking Pictures with a Real Camera. Steps: Graphics does the same thing for rendering an image for 3D geometric objects

CS770/870 Spring 2017 Transformations

Game Architecture. 2/19/16: Rasterization

Computer Graphics Viewing Objective

4. Two Dimensional Transformations

CPSC 314, Midterm Exam. 8 March 2013

Lecture 4. Viewing, Projection and Viewport Transformations

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

Geometry: Outline. Projections. Orthographic Perspective

Transcription:

Three-Dimensional i Viewingi Chap 7, 29 Spring Yeong Gil Shin

Viewing i Pipeline H d fi i d? How to define a window? How to project onto the window?

Rendering "Create a picture (in a snthetic camera) Specification of projection tpe Specification of viewing parameters: viewer's ee, viewing plane (viewing coordinates) Clipping in 3D: window, view volume Projection : the transformation of points from a coordinate sstem in n dimensions to a coordinate sstem in m dimensions where m<n Displa: view port

General 3D Viewing i Pipeline Modeling coordinates (MC) World coordinates (WC) Viewing coordinates (VC) VRC, camera position Projection coordinates (PC) window, projection tpe Normalied coordinates (NC) Device coordinates (DC) view port in a screen

Projections Projection coordinate sstem: Left-handed Core, DirectX wh? h? - screen coordinate sstem is left-handed d Right-handed - GKS, PHIGS, OpenGL Projection plane (view plane): viewing surface where objects are projected. v n u

Viewing-Coordinate Parameters View reference point (VRP) The viewing origin in WC : P Ee position, camera position = (,, ) Viewing Coordinate : view, view, view (or uvn) Defined b P,N,VUP View-plane (Projection plane) Locates on view ais : vp Perpendicular to view

Viewing-Coordinate Parameters How we specif a view plane normal vector, N [Wa I] The origin of WC to a selected point position [Wa II] The direction from a reference point P ref to the viewing origin: N = P P ref P ref : look-at point ref Viewing direction: N (in RHS)

Viewing-Coordinate Parameters View-up vector: VUP Specified in the world coordinates Used to establish the positive direction for the view ais VUP should be perpendicular to N, but it can be difficult to a direction for VUP that is precisel perpendicular p to N view VUP view N P = VRP view

Viewing-Coordinate Reference Frame (VRC) The camera orientation is determined b viewing reference frame, View Reference Coordinate (VRC), view, view, view (or uvn) The origin of the viewing reference frame : P (= VRP) n = N = ( n, n, n ) N VUP n u = VUP v = n u = ( u, u, u = ( v, v, v ) ) n VUP N v P View plane w.r.t. VRC u

World-to-Viewing Transformation Transformation from WC to VRC Translate the viewing-coordinate origin to the worldcoordinate origin Appl rotations to align the u, v, n aes with the world w, w, w aes, respectivel u v n

World-to-Viewing Transformation v v v u u u T R = = n n n T R u n v P P u u u u = =, P n P v T R M vc wc n n n v v v

Eample of VRC WC Given R VUP R R R R = = VPN = VUP = R VUP VUP = 2.5 = det 2.5 = R R R R ( 6 8 7.5) ( ) ( 6, 8, 7.5) i 6. j 8. = (.8,.6,.) VPN = (.48,.64,.6), k 7.5 = (.35,.48,.8) = 2.5 VUP ( 8. 6..) R R R R =

Hierarch of plane geometric projections plane geometric projections parallel perspective orthographic aonometric oblique trimetric cavalier cabinet dimetric isometric single-point two-point three-point

Parallel l Projections Parallel l direction of projection (DOP) Direction of projection same for all points The parallel l projection of fthe point t( (,,) on the -plane gives ( + a, + b,) When a = b =, the projection is said to be orthographic or orthogonal. Otherwise, it is oblique. Preserves relative dimension Orthographic parallel projections The direction of projection is normal to the projection plane Architectural, engineering drawings

Aonometric Parallel Projection Orthographic h parallel l projection that displas more than one face of an object Projection plane intersects each principal ais Classif b how man identical angles of a corner of a projected cube. Three: isometric Two: dimetric None : trimetric t i

Oblique Parallel Projections Parallel projection of which DOP is not perpendicular to the projection plane Onl faces of the object parallel to the projection plane are shown true sie and shape DOP α A' B' Α Β C AB = A' B' B' C' = BC 2 α = arctan(/ 2) = 26. 565 C ' )

Oblique Parallel Projections cavalier projections DOP 45 cabinet projections DOP 63.4

Perspective vs. Parallel Projections Perspective Parallel

Perspective Projections Lines that are not parallel l to the projection plane converge to a a single point in the projection (the vanishing point) Lines parallel to one of the major ais come to a vanishing point, these are called (principle) ais vanishing points. Onl three ais vanishing points in 3D space. Vanishing point

Projection Tpes

Projections Window a rectangular region on the projection plane (defined in VRC) Projection Reference Point (PRP) PRP is specified in the VRC sstem In general, PRP = the origin of Viewing reference coordinate Direction of projection (DOP): in a parallel projection, PRP CW Center of projection (COP): in a perspective projection, PRP = COP v window n COP=PRP u CW (Center of Window) Projection Plane

View Volume (View Frustum) 3D clipping region where we can see Defined b front and back clipping planes (which are parallel to view plane) (,,) (right,top,near) COP (left,bottom,near) far near and far are positive

Create a View Volume (left, top) far v near u (right, bottom) n CW is not aligned n-ais (left, right, top, bottom, near, far) n width far height v near u CW is aligned n-ais (width, height, ht near, far) n far CW is aligned n-ais v near (field of view, aspect, near, far) aspect = width/height u field of view

3D Viewing i ) Establishing a View Reference Coordinate Sstem User suppl the following parameters the view reference point (VRP) - in WC VPN - a vector in WC VUP - a vector in WC v n VRP u

3D Viewingi 2) View Mapping (WC VRC NPC) the projection tpe the Projection Reference Point (PRP) a view plane distance (= vp ) In DirectX, view plane is identical to near plane anearplaneandafarplanedistance 3) device-dependent dependent transformation v n PRP=COP u

Planar Geometric Projections Mathematics of Planar Geometric Projections P(,,) P p ( p, p,d) COP d Centre of projection at the origin Centre of projection at the origin Projection plane at =d

Planar Geometric Projections = = d d p p ; P(,,) P (,,d) = = = = d d d d d d p p / ; / P p ( p, p,d) d Y X d d / / = = d P M W Z Y per / = = d d d X Y X d W p p p, /, / ),, (,, / d d W W W p p p, /, / ),, (,,

Normaliing i Transformation Transform an arbitrar parallel- or perspectiveprojection view volume into the normalied or canonical view volume (in DirectX) or or - B - F - B - F parallel-projection canonical view volume - - perspective-projection canonical view volume

Normaliing i Transformation OpenGL

Normaliing transformation for parallel projections. Translate VRP to the origin of the WC 2. Rotate VRC such that n ais = ais, u ais = ais and v ais = ais. (B & 2, transformation from WCS to VRC) 3. Shear so the direction of projection parallel to the ais. (not necessar for orthographic projections) 4. Translate and scale into the parallel-projection canonical view volume v WC n u VRP (=PRP) CW

Normaliing transformation for parallel projections [Step2] R ( θ ) R ( φ ) R ( α ) ( VUP n Or use orthogonal matri properties v VRP VPN R u VPN VUP R = R = R = R R VPN VUP R r r2 r3 r r2 r3 R = r r r 2 3

Normaliing transformation for parallel projections [Step 3] shearing after step2, VRC = WC DOP = CW - PRP DOP VPN DOP - VPN -

Normaliing transformation for parallel projections -component of DOP is invariant. a b SH a b (, ) = DOP = CW PRP = dop wc ( dop dop ) DOP VPN - DOP - VPN a b DOP DOP ' = wc = dop dop dop a =, b = dop dop

Normaliing transformation for parallel projections View volume after transformation steps to 3 (u ma, v ma, B) - B - - or F (u min, v min, F) Step4 -

Normaliing transformation for parallel projections [Step 4] translate and scale. Translate satethe front center of the view volume ou uma + umin v + vmin T = ma par T,, F 2 2 2. Scale to the 2 2 sie 2 2 S par = S,, uma umin vma vmin F B

Normaliing transformation for perspective projection. Translate VRP to the origin of the WC: T( VRP) 2. Rotate VRC such that n ais = ais, u ais = ais and v ais = ais 3. Translate such that PRP=(prp u, prp v, prp n ) is at the origin: T( PRP) 4. Shear so the center line of the view volume becomes the -ais 5. (Scale such that the view volume becomes the canonical perspective view volume.) v WC n PRP=COP u

Normaliing transformation for perspective projection After step,2,3 Step 4 v n u PRP v n u

Normaliing transformation for perspective projection [Step 4] shearing shear so that CW PRP is into ais SH per = SH par Another Wa: VRP' = SH per T(-PRP) [ ] T component of VRP': vrp = prp n PRP

Normaliing transformation for perspective projection [Step 5] scale. Scale and to give the sloped planes bounding the view-volume unit slope. Scale the window so its half-height eg tand half-width are both vrp scale : scale : 2 vrp' ( u ma u min ) 2 vrp' ( v ma v min ) vrp v ma v min 2 = vrp ' + B ' ' v ma = vrp + F v 2 min

Normaliing transformation for perspective projection 2. Scale uniforml all three aes such that the back clipping plane =vrp +B becomes. scale factor: /(vrp +B) Perspective scale transformation ti S per = 2vrp ' 2vrp' S,, ( uma umin )( vrp' + B) ( vma vmin )( vrp' + B) ( vrp' + B)

DirectX: Viewing Transformation How to define VRC Ee-Point (= VRP) Look-At Position Look-At Position - Ee-Point N Up-Vector ( v, view ) Ee Up-vector v n LHS u Look-at Snta D3DXMATRIX *D3DXMatriLookAtLH( D3DXMATRIX *pout, CONST D3DXVECTOR3 *pee, CONST D3DXVECTOR3 *pat, CONST D3DXVECTOR3 *pup ); Parameters pout : Pointer to the D3DXMATRIX structure that is the result of the operation. pee : Pointer to the D3DXVECTOR3 structure that defines the ee point. pat : Pointer to the D3DXVECTOR3 structure that defines the camera look-at target. pup : Pointer to the D3DXVECTOR3 structure that defines the current world's up, usuall [,, ].

DirectX: Orthographic Parallel Projection Transformation Snta D3DXMATRIX *WINAPI D3DXMatriOrthoLH( D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT n, FLOAT f ); Parameters pout : Pointer to the D3DXMATRIX structure that contains the resulting matri. w : Width of the view volume. h : Height of the view volume. n : Minimum -value of the view volume which is referred to as -near. f : Maimum -value of the view volume which is referred to as -far. view view near w far h view

DirectX: Oblique Parallel Projection Transformation Snta D3DXMATRIX *D3DXMatriOrthoOffCenterLH (D3DXMATRIX *pout,, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT n, FLOAT f ); Parameters pout : Pointer to the D3DXMATRIX structure that is the result of the operation. l : Minimum -value of view volume. r : Maimum -value of view volume. b : Minimum -value of view volume. t : Maimum -value of view volume. n : Minimum -value of the view volume. f : Maimum -value of the view volume. view near far view view

DirectX: Perspective Projection Transformation When CW aligns n-ais Snta D3DXMATRIX *D3DXMatriPerspectiveFovLH( D3DXMATRIX *pout, FLOAT fov, FLOAT Aspect, FLOAT n, FLOAT f ); Parameters pout : Pointer to the D3DXMATRIX structure that is the result of the operation. fov : Field of view in the direction, in radians. Aspect : Aspect ratio, defined as view space width divided b height. n : Z-value of the near view-plane. f :Z-value of the far view-plane. n = view v = view far near u = view

DirectX: Perspective Projection Transformation When CW does not align n-ais Snta D3DXMATRIX *D3DXMatriPerspectiveOffCenterLH (D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT n, FLOAT f ); Parameters pout : Pointer to the D3DXMATRIX structure that is the result of the operation. l : Minimum -value of the view volume. r : Maimum -value of the view volume. b : Minimum -value of the view volume. t : Maimum -value of the view volume. n : Minimum -value of the view volume. f : Maimum -value of the view volume. view far near view view

3D Clipping i For orthographic projection, view volume is a bo For perspective projection, view volume is a frustum left Near clipping plane Far clipping plane. right Need to calculate intersection with 6 planes

3D Clipping i Clipping is efficientl done on the normalied view volume. The canonical parallel projection view volume is defined b:,, Clip primitives against this view volume

3D Region Coding for Clipping 3-D Etension of 2-D Cohen-Sutherland Algorithm For parallel-projection canonical view volume : Bit - point is above view volume: > Bit 2 - point is below view volume: < Bit 3 - point is right of view volume: > Bit 4 - point is left view volume: < Bit 5 - point is behind view volume: < Bit 6 - point is in front of view volume: > B or F

3D Region Coding for Clipping

3D Region Coding for Clipping For perspective-projection canonical view volume + F = B Bit - Point is above view volume > Bit 2 - Point is below view volume < Bit 3 - Point is right of view volume > Bit 4 - Point is left of view volume < Bit 5 - Point is behind view volume < = Bit 6 - Point is in front of view volume > min

Clipping and Homogeneous Coordinates Efficient to transform frustum into perspective canonical view volume unit slope planes Even better to transform to parallel canonical view volume Clipping i must be done in homogeneous coordinates We do not need to [X,Y,Z,W] [,,,] for the clipped region Points in homogeneous coordinate can appear with W and cannot be clipped properl in 3D

Clipping and Homogeneous Coordinates 3D parallel projection volume is defined b:,, Replace b X/W,Y/W,Z/W: X/W, Y/W, Z/W Corresponding plane equations are : X= W, X=W, Y= W, Y=W, Z= W, Z= If W>, multiplication li b W does not change sign. W>: W X W, W Y W, W Z However if W<, need to change sign : W<: W X W, W Y W, W Z

Clipping and Homogeneous Coordinates For the canonical parallel projection volume:,,, To clip to = (left): Homogeneous coordinate: Clip to X/W = Homogeneous plane: W+X = Point is visible if W+X >

Clipping and Homogeneous Coordinates The intersection of the line segment with a clipping plane: P 2 = ( α)p + αp and w + = [( α) w + αw2 ] + [( α) + α2] = P α = (w + + w 2 ) (w 2 + 2 ) P 2 Repeat for remaining boundaries : other Near and Far clipping planes

Clipping and Homogeneous Coordinates (eample) P = [ 2, *, *,2] P = [, 2*, 2*, 2 ] 2 OB region P 2 P α = (w + w 2 + ) (w 2 2 ) 2 + 2 ( 2) ( 2) 2 = = + 8 9 * * * * * * * P = [ 2, 8 8 2 + ( 2 ), + ( 2 ), ] 3 9 9 3 * Projected -coordinate of P = = w

Points in Homogeneous Coordinates W Region A P =[ 2 3 4] T W= Projection of P and dp 2 onto W= plane X or Y Region B P 2 =[ 2 3 4] T Need to consider both regions when performing clipping

Lines in Homogeneous Coordinates Could clip twice once for region A, once for region B. Epensive Check for negative W values and negate points before clipping P W Projection of points W= X P2

Lines in Homogeneous Coordinates P W Clipped lines W=X W= X W= X P2

3D Polgon Clipping Algorithms Bounding bo or sphere test for earl rejection Sutherland-Hodgman and Weiler-Atherton algorithms can be generalied

What s Net