Modeling and The Viewing Pipeline Jian Huang CS594 The material in this set of slides have referenced slides from Ohio State, Minnesota and MIT.

Slides:



Advertisements
Similar presentations
Lecture 3: Transformations and Viewing. General Idea Object in model coordinates Transform into world coordinates Represent points on object as vectors.
Advertisements

Three Dimensional Viewing
1 Computer Graphics Chapter 8 3D Transformations.
Introduction to 3D Graphics Lecture 5: From Realism to Real-Time Anthony Steed University College London.
Viewing and Projections
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
CS485/685 Computer Vision Prof. George Bebis
Lecture 12: Projection CS4670: Computer Vision Noah Snavely “The School of Athens,” Raphael.
Lecture 3 – Transformation And Coordinate Systems
Viewing Doug James’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals of Computer Graphics, Chap 7 Wen-Chieh (Steve) Lin Institute of Multimedia.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
Scenes, Cameras & Lighting. Outline  Constructing a scene  Using hierarchy  Camera models  Light models.
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
Projection Projection - the transformation of points from a coordinate system in n dimensions to a coordinate system in m dimensions where m
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
Introduction to 3D viewing 3D is just like taking a photograph!
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 Andries van Dam September 23, D Viewing III 3D Viewing III.
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 Andries van Dam September 22, D Viewing III Kansas State University CIS 636 Fundamentals.
Viewing and Projections
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Computer Graphics (fall 2009)
Review of Selected Surface Graphics Topics (1)
02/26/02 (c) 2002 University of Wisconsin, CS 559 Last Time Canonical view pipeline Orthographic projection –There was an error in the matrix for taking.
Advanced Computer Graphics Three Dimensional Viewing
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
2 COEN Computer Graphics I Evening’s Goals n Discuss the mathematical transformations that are utilized for computer graphics projection viewing.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
C O M P U T E R G R A P H I C S Jian Chen January 15, 2010 Viewing III 1/42 3D Viewing III By Andries van Dam.
CS-378: Game Technology Lecture #2.1: Projection Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
Computer Graphics Bing-Yu Chen National Taiwan University.
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
CS559: Computer Graphics Lecture 9: Rasterization Li Zhang Spring 2008.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Jinxiang Chai CSCE 441 Computer Graphics 3-D Viewing 0.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
Three-Dimensional Viewing
Three-Dimensional Viewing Hearn & Baker Chapter 7
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
CS559: Computer Graphics Final Review Li Zhang Spring 2010.
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
A Photograph of two papers
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
Slide 1Lecture Fall ‘00 Surface Modeling Types: Polygon surfaces Curved surfaces Volumes Generating models: Interactive Procedural.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
Outline 3D Viewing Required readings: HB 10-1 to 10-10
Three Dimensional Viewing
Rendering Pipeline Fall, 2015.
CSCE 441 Computer Graphics 3-D Viewing
CSC461: Lecture 20 Parallel Projections in OpenGL
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
CENG 477 Introduction to Computer Graphics
Viewing/Projections I Week 3, Fri Jan 25
Three Dimensional Viewing
OpenGL 2D Viewing Pipeline
Lecture 13: Cameras and geometry
Last Time Canonical view pipeline Projection Local Coordinate Space
Clipping Jian Huang, CS594 This set of slides reference slides devised at Ohio State and MIT.
Viewing (Projections)
Viewing (Projections)
Presentation transcript:

Modeling and The Viewing Pipeline Jian Huang CS594 The material in this set of slides have referenced slides from Ohio State, Minnesota and MIT.

Modeling Types: –Polygon surfaces –Curved surfaces Generating models: –Interactive –Procedural

Polygon Mesh Set of surface polygons that enclose an object interior, polygon mesh De facto: triangles, triangle mesh.

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

Arriving at a Mesh Use patches model as implicit or parametric surfaces Beziér Patches : control polyhedron with 16 points and the resulting bicubic patch:

Example: The Utah Teapot 32 patches single shaded patch wireframe of the control points Patch edges

Patch Representation vs. Polygon Mesh Polygons are simple and flexible building block. But, a parametric representation has advantages: –Conciseness A parametric representation is exact and analytical. –Deformation and shape change Deformations appear smooth, which is not generally the case with a polygonal object.

Common Polyhedral Shape Construction Operations Extrude: add a height to a flat polygon Revolve: Rotate a polygon around a certain axis Sweep: sweep a shape along a certain curve (a generalization of the above two) Loft: shape from contours (usually in parallel slices) Set operations (intersection, union, difference), CSG (constructive solid geometry) Rounding operations: round a sharp corner

Sweep (Revolve and Extrude)

Constructive Solid Geometry (CSG) To combine the volumes occupied by overlapping 3D shapes using set operations. unionintersectiondifference

A CSG Tree

Example Modeling Package: Alias Studio

Pinhole Model Visibility Cone with apex at observer Reduce hole to a point - the cone becomes a ray Pin hole - focal point, eye point or center of projection. P P F

zFilling Algorithms - Flood Fill zflood_fill (x, y, old_color, new_color, connectivity) zif read_pixel(x, y) = old_color then zdraw_pixel(x, y, new_color); zrecursive_call(x, y, old_color, new_color, connectivity); zend_if; 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 Side note: animation:vary transformations over time to create motion WORLD OBJECT EYE

Viewing Pipeline 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 World Space Eye Space Clipping Space Canonical view volume Screen Space

Spaces: Example Object Space and World Space: Eye-Space :

Spaces: Example zClip Space: zImage 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 Together Order matters !!

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 and Pin Hole Camera 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) F Image World I W

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

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

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 Z [0, d] [0, 0] [Y, Z] [(d/Z)Y, d] 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] 2-D image point: discard third coordinate apply viewport transformation to obtain physical pixel coordinates d000 0d00 00d               x y z 1                dxdydzz    d z x d z yd       Divide by 4th coordinate (the “w” coordinate)

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 z’ 1 alpha yon hither

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   Angle or Field of view (FOV)  AR Aspect Ratio of view-port  Hither, YonNearest 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 = (v x z)/|v x z| rotation angle: cos  = az and sin  = |r x z| OpenGL: glRotate(  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 [ ] T. After affine transform, the homogeneous coordinate w maintains unity.