Computer Graphics 3Practical Lesson

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

OpenGL Course Notes Chapter 3: Viewing Jim Mims, Spring 2009.
02/17/05CISC640/440 OpenGL Tutorial1 OpenGL Tutorial CISC 640/440 Computer Graphics TA: Qi Li/Mani Thomas
1 View Shandong University Software College Instructor: Zhou Yuanfeng
CLASS 6 PERSPECTIVE CS770/870. Orthographic projections Isometric ObliqueIn isometric all distances along the major axes are the same.
OpenGL Basics Donghui Han. Assignment Grading Visual Studio Glut Files of four types needed: – Source code:.cpp,.h – Executable file:.exe (build in release.
Viewing and Transformation
Viewing and Projections
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
CS 352: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
OpenGL (II). How to Draw a 3-D object on Screen?
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee.
Noggin (BYU Students, SIGGRAPH 2006). Introduction to OpenGL Programming Rick Skarbez, Instructor COMP 575 September 11, 2007.
Development of Interactive 3D Virtual World Applications
CS 470 Introduction to Computer Graphics Basic 3D in OpenGL.
Introduction to 3D viewing 3D is just like taking a photograph!
2002 by Jim X. Chen: 2D viewing –Window –Viewport 3D viewing –Projection methods and viewing volumes –Normalization –Clipping.
Viewing & Perspective CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005.
3D coordinate systems X Y Z Right-Hand Coordinate System X Y Z Left-Hand Coordinate System OpenGL uses this! Direct3D uses this!
1 OpenGL Basics A Graphics Standard ©Mel Slater, Anthony Steed
Advanced Computer Graphics Three Dimensional Viewing
GLWidget Description Jason Goffeney 3/8/2006. GLWidget The GLWidget class extends the Qt QGLWidget. The QGLWidget is a Qt Widget that happens to have.
Computer Graphics, KKU. Lecture 131 Transformation and Viewing in OpenGL.
The Viewing Pipeline (Chapter 4) 5/26/ Overview OpenGL viewing pipeline: OpenGL viewing pipeline: – Modelview matrix – Projection matrix Parallel.
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.
CSE 470: Computer Graphics. 10/15/ Defining a Vertex A 2D vertex: glVertex2f(GLfloat x, GLfloat y); 2D vertexfloating pointopenGL parameter type.
Introduction to OpenGL 1. 2 OpenGL A Graphics rendering API introduced in 1992 by Silicon Graphics Inc Provide the low-level functions to access graphics.
Computer Graphics Bing-Yu Chen National Taiwan University.
OpenGL: Introduction Yanci Zhang Game Programming Practice.
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.
Viewing and Transformation. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture.
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.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
CGGM Lab. Tan-Chi Ho 2001 Viewing and Transformation.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing
Projections. Viewports Windows can have separate viewports void glViewport(GLint x, GLint y, GLsizei width, GLsizei height ) x, y - Specify the lower.
Viewing Korea Univ. Computer Graphics Lab. Hong, Jin Kyung.
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Chap 3 Viewing and Transformation
Honours Graphics 2008 Session 3. Today’s focus Perspective and orthogonal projection Quaternions Graphics camera.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
CS559: Computer Graphics Lecture 12: OpenGL - Transformation Li Zhang Spring 2008.
Implement of transformation,projection, viewing Hanyang University Jungsik Park.
CSC Graphics Programming Budditha Hettige Department of Statistics and Computer Science.
OpenGL LAB III.
Computer Graphics Lecture 41 Viewing Using OpenGL Taqdees A. Siddiqi
CS 490: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
CSC Graphics Programming
Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Viewing.
Computer Viewing.
Courtesy of Drs. Carol O’Sullivan / Yann Morvan Trinity College Dublin
CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi
CSCE 441 Computer Graphics 3-D Viewing
Reference1. [OpenGL course slides by Rasmus Stenholt]
Unit 4 3D Viewing Pipeline Part - 2
Projection v VP u VPN n.
VIEWING 2D viewing Window Viewport
Advanced Graphics Algorithms Ying Zhu Georgia State University
Lecture 08 and 09 View & Projection
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Computer Graphics, KKU. Lecture 13
Class 12 Complex object with moving parts
Type of View Perspective View COP(Center of Plane) Diminution of size
Chapter 3 Viewing.
Projection v VP u VPN n.
Presentation transcript:

Computer Graphics 3Practical Lesson Viewing and Projection Ayal Stein

The Camera Analogy The transformation process to produce a scene for viewing is analogous to taking a photograph with a camera. 1. Setting the camera position is like viewing transformation

The Camera Analogy 2. Arrange the scene to be photographed is like modeling transformation. 3. Choose a camera lens or adjust the zoom (Projection transformation). 4. Determine final photograph size - for example, you might want it enlarged (Viewport transformation).

Viewing Transformations Setting the position of the “camera”. In openGL, we use the command: void gluLookAt( GLdouble eyeX, GLouble eyeY,   Gldouble eyeZ,   GLdouble   centerX,   GLdouble   centerY,   GLdouble   centerZ,   GLdouble   upX,   GLdouble   upY,   GLdouble   upZ);

Viewing Transformations This is the default status of the camera in OpenGL: 1. The eye vector is aimed at the negative z direction. 2. The position of the camera is at the beginning of the axis 3. The up vector is to the y axis.

Modeling Transformation We discussed this process on the previous presentation. We will review the matrix stack again in this presentation.

The matrix stack The stack contains matrices of transformation on the model ( translate , rotate , resize ). In addition , there is current matrix which all transformation operations are applied on it. On each shape drawn – all the transformation of shapes in matrix and current matrix are applied on it.

The matrix stack(cont’) glPushMatrix() pushes the current matrix into the queue. glPopMatrix() Extract matrix from the stack

Drawing Robot Example First we rotate the entire model according to user rotation. Before starting drawing any component, we call the glPushMatrix() to save the previous transformation. When we finish drawing the component, we call glPopMatrix() to restore previous transformations.

Projection transformation There are 2 modes for projection: 1. Orthographic projection – the viewing area of the model is a cubic region. Each object will appear at the same size, regardless to its distance to the camera. 2. Perspective view – more realistic, like the human vision- the closer the object to the camera, the larger it will appear.

Orthographic projection Used in CAD designing and 2d games/graphics. The viewing area of the model is a cubic region described in the following image:

Orthographic projection(cont’) Setting orthographic projection: void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far); The function receives 6 parameters Near and far is the distance from the camera.

Perspective projection There are 2 function to create this projection. glFrustum: void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far); Show thing that exists in the pyramid between the plains near and far.

cont’))Perspective projection gluPerspective: void gluPerspective( GLdouble   fovy, GLdouble   aspect, GLdouble   zNear, GLdouble   zFar); Fovy is the angle of the camera. Aspect is the ratio between x and y axis

cont’))Perspective projection Both functions has the same effect. glFrustum is part of OpenGL gluPerspective is part of the extension library GLUT. glFrustum requires explicit dimension while gluPerspective requires angle and aspect ratio only. gluPerspective allows create asymmetric viewing area, which can be useful to some cases.

Viewport Transformation Viewport transformation maps the view plane onto an area of the screen. void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); x,y specifies the lower left corner of the viewport. width and height are the size of the viewport rectangle