CLASS 6 PERSPECTIVE CS770/870. Orthographic projections Isometric ObliqueIn isometric all distances along the major axes are the same.

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

Three Dimensional Viewing
1 Computer Graphics Chapter 8 3D Transformations.
Based on slides created by Edward Angel
Viewing and Projections
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
OpenGL and Projections
Viewing Doug James’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals of Computer Graphics, Chap 7 Wen-Chieh (Steve) Lin Institute of Multimedia.
OpenGL (II). How to Draw a 3-D object on Screen?
Introduction to 3D viewing 3D is just like taking a photograph!
Viewing and Projections
UBI 516 Advanced Computer Graphics Three Dimensional Viewing
Advanced Computer Graphics Three Dimensional Viewing
Geometric transformations The Pipeline
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.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Chapter 5 Viewing.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 67 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 67 Computer Graphics Three-Dimensional Graphics III.
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
Demetriou/Loizidou – ACSC330 – Chapter 5 Viewing Dr. Giorgos A. Demetriou Computer Science Frederick Institute of Technology.
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
Computer Graphics I, Fall 2010 Computer Viewing.
Preserving Normals Lecture 28 Wed, Nov 12, The Effect of a Transformation on a Normal What happens to a normal vector under a linear transformation?
Viewing CS418 Computer Graphics John C. Hart. Graphics Pipeline Homogeneous Divide Model Coords Model Xform World Coords Viewing Xform Still Clip Coords.
CS 4731: Computer Graphics Lecture 13: Projection Emmanuel Agu.
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.
OpenGL Viewing and Modeling Transformation Geb Thomas Adapted from the OpenGL Programming Guidethe OpenGL Programming Guide.
University of North Carolina at Greensboro
Graphics Graphics Korea University kucg.korea.ac.kr Viewing 고려대학교 컴퓨터 그래픽스 연구실.
Viewing and Transformation. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
The Camera Analogy ► Set up your tripod and point the camera at the scene (viewing transformation) ► Arrange the scene to be photographed into the desired.
Projections. Viewports Windows can have separate viewports void glViewport(GLint x, GLint y, GLsizei width, GLsizei height ) x, y - Specify the lower.
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Chap 3 Viewing and Transformation
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.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CS5500 Computer Graphics March 20, Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts.
OpenGL LAB III.
Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Visible Surface Detection
Computer Graphic 2 D Viewing.
Viewing.
Computer Graphics - Chapter 5 Viewing
University of North Carolina at Greensboro
Computer Viewing.
Courtesy of Drs. Carol O’Sullivan / Yann Morvan Trinity College Dublin
Isaac Gang University of Mary Hardin-Baylor
CSCE 441 Computer Graphics 3-D Viewing
CSC461: Lecture 20 Parallel Projections in OpenGL
CENG 477 Introduction to Computer Graphics
Graphics Pipeline Clipping
WINDOWING AND CLIPPING
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Three-Dimensional viewing
WINDOWING AND CLIPPING
Last Time Canonical view pipeline Projection Local Coordinate Space
University of New Mexico
Viewing (Projections)
Computer Graphics 3Practical Lesson
Translation in Homogeneous Coordinates
Presentation transcript:

CLASS 6 PERSPECTIVE CS770/870

Orthographic projections Isometric ObliqueIn isometric all distances along the major axes are the same

Orthographic Oblique using a shear Move x and y proportional to the depth

To generate Oblique perspective Cot(  ) = dx/dz Cot(  ) = dy/dz

Orthographic projection matrix The effect is to scale in to a [-1,+1] cube. Note – the mapping into a viewport is actually done in two stages First we map into a cube. Then we map into the viewport. Reason:Clipping

The Z buffer algorithm Problem, how do we make sure that nearer objects hide further objects? A reason why we need to preserve depth after projection. The z-buffer contains depth information about an image for every pixel that is rendered between the near and the far clipping plane. For each pixel, about to be rendered.  If closer than z-buffer depth draw rgb and z value.  Else, discard. It works because the image has already been transformed

Perspective. How to get the scaling

Brunelleschi’s window

Perspective transformation - simplified Final step, divide x and y by w w=z/d M = PS Where P is the projective transformation matrix (above) S is the Scene to Viewport mapping

Two specifications glFrustum (Left,Right, Bottom, Top, Near, Far); gluPerspective(fov, aspect, near far); Why?

View control The Lookat function from a viewpoint (vp) to a scene point (sp) gluLookat(vpX,vpY, vpZ, spX,spY,spZ, upX, upY, upZ); Three ways of doing it. Using gluLookat, or using translate and rotate, or Using change in basis.

Change in basis Express one set of axes in the coordinates of another. In a simple form this is a rotation. X Y UV Coordinates of U,V axis As unit vectors Expressed in X,Y system (x,y) Convert point (x,y) to point (u,v)

How to get a rotation to view vector Use basis method (atX, atY) (eY,eY) 1)Take difference 2)Normalize 3)Put into matrix form v n

To deal with the Up Vector in 3D Purpose, Rotate view so that some defined up in the scene is aligned with the vertical direction on the screen. Calculate view vector v (difference + normalize) Given up vector u use cross products Side ways vector of view coords s= u x v New up vector n = u x s sxsx sysy szsz nxnx nyny nznz vxvx vyvy vzvz Useful fact: the Transpose of a rotation matrix is its inverse.

How to fly Keep moving the viewpoint in the direction of travel Rotate according to the view direction. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glRotatef(viewAngle*180.0/ , 0,1,0); glTranslatef(-eyeX,-eyeY, -eyeZ); // to origin scene(); glPopMatrix(); glutSwapBuffers(); df = my*0.01; // the speed in the forward direction (my from mouse) viewAngle += mx*0.0001; // Azimuth in radians dz = cos(viewAngle)*df; dx = sin(viewAngle)*df; eyeX += dx; eyeZ -= dz;

Clipping Cohen Sutherland The outcode function returns an outcode as follows XminXmax Ymin Ymax bbbb >Ymax >Xmax < Ymin < Xmin

Cohen Sutherland Cases p1 p2 Let o1 be the outcode of p1 Case A: o1 = o2 = 0; Both inside, no clipping needed Case B: (o1 & 02) |= 0; all bits same  same region  discard Case C: (o1 XOR 01) > 0 ; some bits different different regions, may need clipping A B C C different regions, may need clipping C