Transformations (Rotations with Quaternions) October 24, 2005

Size: px
Start display at page:

Download "Transformations (Rotations with Quaternions) October 24, 2005"

Transcription

1 Computer Graphics Transformations (Rotations with Quaternions) October 4, 5 Virtual Trackball (/3) Using the mouse position to control rotation about two axes Supporting continuous rotations of objects trackball frame

2 Virtual Trackball (/3) Rotation with a virtual trackball projection of the trackball position to the plane x + y + z = r y = r x z Virtual Trackball (3/3) Rotation with a virtual trackball (cont ) determination of the orientation of a plane n = p p rotation angle θ = cos Quaternions ( p p ) n θ

3 Quaternions (/) One real part + three imaginary part q = s + ia+ jb+ kc Properties: i = j = k ij = ji = k jk = kj = i ki = ik = j = Addition and scalar multiplication ( s + s ) + i( a + a ) + j( b + b ) + k( c ) q + + q = c dq = sd + iad + jbd + kcd Quaternions (/) Ordered-pair notation scalar s + vector v = (a, b, c) Addition: q Multiplication q q = s s v v, s v + s v + v v Magnitude q q = + q = s ( s, v) ( s +, v + v ) ( ) = s + v v Inverse ( s, v) qq = q q = (, ) q = q

4 Quaternions and 3D Rotation For a 3D point (α, β, γ) a unit quaternion q = ( s, a, b, c) q = ( s, a, b, c) q, α, β, γ q =, α, β, γ For q = its conjugate ( ) ( ) Rotating (α, β, γ) by angle θ about the axis parallel to (u x, u y, u z ) ( cosθ, sinθ ( u, u, u ) R q is a 3D rotation about (u x, u y, u z ) by θ R q x y ( p) = q p q z Rotations with Quaternions (/) Rotation about any axis setting up a unit quaternion (u: unit vector) θ θ s = cos, v = usin = ( a, b, c) representing any point position P in quaternion notation (p = (x, y, z)) P =, p ( ) carrying out with the quaternion operation (q - =(s, v)) P = qpq producing the new quaternion P =, p ( ) ( p v) + ( v p) + v ( v p) p = s p + v s

5 Rotations with Quaternions (/) Obtaining the rotation matrix by quaternion multiplication M R ( θ ) b c = ab+ sc ac sb = R Including the translations x ( θ ) R ( θ ) R ( θ ) R ( θ ) R ( θ ) R x y a y ab sc bc + sa ( θ ) = T M ( θ )T R z c y y ac + sb bc sa a x x b Header File for a Trackball typedef double vec3d[3]; #ifndef M_PI #define M_PI #endif class TrackBall private: int width, height; vec3d lastpos; //quaternions double s; vec3d v; public: double rmat[6]; public: TrackBall(); virtual ~TrackBall(); ; void initialize( void ); void resize( const int &cx, const int &cy ); void project( int &xi, int &yi, vec3d &v ); void start( int xi, int yi ); void end( int xi, int yi );

6 Vector Operations void normalize( vec3d &v ) double d =. / sqrt( v[]*v[] + v[]*v[] + v[]*v[] ); v[] *= d; v[] *= d; v[] *= d; return; double dot( vec3d &a, vec3d &b ) return (a[]*b[] + a[]*b[] + a[]*b[]); void cross( vec3d &a, vec3d &b, vec3d &c ) c[] = a[]*b[] - a[]*b[]; c[] = a[]*b[] - a[]*b[]; c[] = a[]*b[] - a[]*b[]; return; Projection to a Hemisphere TrackBall::TrackBall() initialize(); TrackBall::~TrackBall() void TrackBall::initialize( void ) s =.; v[] = v[] = v[] =.; for(int i=; i<6; i++) rmat[i] =.; rmat[] = rmat[5] = rmat[] = rmat[5]=.; return; void TrackBall::resize( const int &cx, const int &cy ) width = cx; height = cy; return; void TrackBall::project( int &xi, int &yi, vec3d &v ) v[] = (.*xi - width) / (double)width; v[] = (height -.*yi) / (double)height; double d = sqrt( v[]*v[] + v[]*v[] ); v[] = cos(m_pi *.5 * ((d<.)? d :.) ); normalize( v ); return;

7 Creation of Quaternions void TrackBall::start( int xi, int yi ) project( xi, yi, lastpos ); return; void TrackBall::end( int xi, int yi ) vec3d currpos, t; project( xi, yi, currpos ); t[] = currpos[] - lastpos[]; t[] = currpos[] - lastpos[]; t[] = currpos[] - lastpos[]; if( t[] t[] t[] ) double angle = M_PI*.5*sqrt( t[]*t[] + t[]*t[] + t[]*t[] ); vec3d axis; cross( currpos, lastpos, axis ); normalize( axis ); double s = sin(angle*.5); vec3d v = s*axis[], s*axis[], s*axis[] ; s = cos(angle*.5); double s = s; vec3d v = v[], v[], v[], v3; cross( v, v, v3 ); s = ( s * s ) - dot( v, v ); v[] = s*v[] + s*v[] + v3[]; v[] = s*v[] + s*v[] + v3[]; v[] = s*v[] + s*v[] + v3[]; Creation of a Rotation Matrix double d =. / sqrt( s*s + v[]*v[] + v[]*v[] + v[]*v[] ); s *= d; v[] *= d; v[] *= d; v[] *= d; // rotation with quaternions // P' = quat * P * quat^- // M = -b^-c^, ab-sc, ac+sb, // ab+sc, -a^-c^, bc-sa, // ac-sb, bc+sa, -a^-b^ ; rmat[] =. -. * (v[]*v[] + v[]*v[]); rmat[] =. * (v[]*v[] - s*v[]); rmat[] =. * (v[]*v[] + s*v[]); //rmat[3] =.; rmat[4] =. * (v[]*v[] + s*v[]); rmat[5] =. -. * (v[]*v[] + v[]*v[]); rmat[6] =. * (v[]*v[] - s*v[]); //rmat[7] =.; rmat[8] =. * (v[]*v[] - s*v[]); rmat[9] =. * (v[]*v[] + s*v[]); rmat[] =. -. * (v[]*v[] + v[]*v[]); //rmat[] =.; //rmat[] = rmat[3] = rmat[4] =.; //rmat[5] =.; lastpos[] = currpos[]; lastpos[] = currpos[]; lastpos[] = currpos[]; return;

8 Global Variables Initialization & Resize

9 Mouse Controls DrawScene ( )

10 Result Virtual Trackball Computer Graphics Viewing October 4, 5

11 Contents Projections in OpenGL Parallel viewing Orthographic projection Perspective viewing Perspective projection Walk through a scene Look-at function Shadow projection Projections in OpenGL Angle of view only objects that fit within the angle of view of the camera appear in the image View volume being clipped out of scene frustum truncated pyramid

12 Parallel Viewing Orthographic viewing function glmatrixmode(gl_projection); glloadidentity( ); ); glortho(xmin, xmax, ymin, ymax, near, far); OpenGL provides only this parallel-viewing function near < far!! no restriction on the sign z max = far z min = near Orthographic Projection (/3) Direction of Projection simple camera view frustum a right parallelepiped y x void glortho(gldouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far) z

13 Orthographic Projection (/3) Orthographic Projection (3/3)

14 Perspective Viewing (/) Specification of a frustum glmatrixmode(gl_projection); glloadidentity( ); ); glfrustum(xmin, xmax, ymin, ymax, near, far); near, far: positive number!! z max = far z min = near Perspective Viewing (/) Specification using the field of view glmatrixmode(gl_projection); glloadidentity( ); ); gluperspective(fovy, aspect, near, far); fovy: the angle of view in the up (y) direction aspect ratio: width divided by height fov: angle between top and bottom planes

15 Perspective Projection (/5) General viewing projection plane anywhere in front of the camera void glfrustum(gldouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far) Perspective Projection (/5)

16 Perspective Projection (3/5) Perspective Projection (4/5)

17 Perspective Projection (5/5) Walking Though a Scene (/) void keys(unsigned char key, int x, int y) if(key == x ) viewer[] -=.; if(key == X ) viewer[] +=.; if(key == y ) viewer[] -=.; if(key == Y ) viewer[] +=.; if(key == z ) viewer[] -=.; if(key == Z ) viewer[] +=.; void display(void) glenable( GL_DEPTH_TEST ); glclearcolor(.f,.f,.f,.f); glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); glmatrixmode(gl_modelview); glloadidentity(); glulookat(viewer[], viewer[], viewer[],,,,,,); glrotatef(theta[],.,.,.); glrotatef(theta[],.,.,.); glrotatef(theta[],.,.,.); colorcube( ); glutswapbuffers( );

18 Walking Though a Scene (/) void myreshape(int w, int h) glmatrixmode(gl_projection); glloadidentity( ); glviewport(,, w, h); if( w <= h ) glfrustum(-.,., -.*(GLfloat)h/(GLfloat)w,.*(GLfloat)h/(GLfloat)w,.,.); else glfrustum(-. *(GLfloat)w/(GLfloat)h,. *(GLfloat)w/(GLfloat)h, -.,.,.,.); return; Look-At Function OpenGL utility function glulookat(eyex, eyey, eyez, atx, aty, atz, upx, upy, upz); eye-position, target-position, and up-vector look-at positioning

19 Definition of Eye Position glulookat ( )

20 Key Controls Walking Though a Scene

21 Exercise () Create a menu view and its sub menus orthographic, and perspective. If you choose one, your program must change its projection. Projections & Shadows (/) Shadow polygon Steps light source at (x l, y l, z l ) translation (-x l, -y l, -z l ) perspective projection through the origin translation (x l, y l, z l ) = = / l l l l l l l z y x y z y x PT T M

22 Projections & Shadows (/) glcolor3fv(polygon_color); glbegin(gl_polygon);.. /* draw the polygon normally */. glend( ); GLfloat m[6]; /* shadow projection matrix */ for(i=; i<6; i++) m[i] =.; m[] = m[5] = m[] =.; m[7] = -./yl; glpushmatrix( ); /* save state */ gltranslatef(xl, yl, zl); /* translate back */ glmultmatrixf(m); /* project */ gltranslatef(-xl, -yl, -zl); /* move light to origin */ glcolorfv(shadow_color); glbegin(gl_polygon);.. /* draw the polygon again */. glend( ); glpopmatrix( ); /* restore state */ Global Variables

23 Shadow Projections Rectangle ( )

24 What s Wrong? () Exercise () Fix your program

25 What s Wrong? () Exercise (3) Fix your program more

Fundamental Types of Viewing

Fundamental Types of Viewing Viewings Fundamental Types of Viewing Perspective views finite COP (center of projection) Parallel views COP at infinity DOP (direction of projection) perspective view parallel view Classical Viewing Specific

More information

Computer Graphics. Basic 3D Programming. Contents

Computer Graphics. Basic 3D Programming. Contents Computer Graphics Basic 3D Programming September 21, 2005 Sun-Jeong Kim 1 http://www.hallym.ac.kr/~sunkim/teach/2005/cga Contents Cameras and objects Perspective projections Orthographic projections Viewing

More information

CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science

CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science CSC 307 1.0 Graphics Programming Department of Statistics and Computer Science Graphics Programming OpenGL 3D Drawing 2 3D Graphics Projections Getting 3D to 2D 3D scene 2D image 3 Projections Orthographic

More information

CS354 Computer Graphics Viewing and Modeling

CS354 Computer Graphics Viewing and Modeling Slide Credit: Donald S. Fussell CS354 Computer Graphics Viewing and Modeling Qixing Huang February 21th 2018 Computer Viewing There are three aspects of the viewing process, all of which are implemented

More information

// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations

// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations #include int main(int argc, char** argv) { glutinit(&argc, argv); Typical OpenGL/GLUT Main Program // GLUT, GLU, and OpenGL defs // program arguments // initialize glut and gl // double buffering

More information

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1 Transformations 1-1 Transformations are used within the entire viewing pipeline: Projection from world to view coordinate system View modifications: Panning Zooming Rotation 1-2 Transformations can also

More information

Computer Viewing Computer Graphics I, Fall 2008

Computer Viewing Computer Graphics I, Fall 2008 Computer Viewing 1 Objectives Introduce mathematics of projection Introduce OpenGL viewing functions Look at alternate viewing APIs 2 Computer Viewing Three aspects of viewing process All implemented in

More information

The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes

The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes What is it? The viewing pipeline is the procession of operations that are applied to the OpenGL matrices, in order to create a 2D representation

More information

Viewing and Projection

Viewing and Projection CSCI 480 Computer Graphics Lecture 5 Viewing and Projection Shear Transformation Camera Positioning Simple Parallel Projections Simple Perspective Projections [Geri s Game, Pixar, 1997] January 26, 2011

More information

Computer Graphics. Chapter 10 Three-Dimensional Viewing

Computer Graphics. Chapter 10 Three-Dimensional Viewing Computer Graphics Chapter 10 Three-Dimensional Viewing Chapter 10 Three-Dimensional Viewing Part I. Overview of 3D Viewing Concept 3D Viewing Pipeline vs. OpenGL Pipeline 3D Viewing-Coordinate Parameters

More information

CS559: Computer Graphics. Lecture 12: OpenGL Transformation Li Zhang Spring 2008

CS559: Computer Graphics. Lecture 12: OpenGL Transformation Li Zhang Spring 2008 CS559: Computer Graphics Lecture 2: OpenGL Transformation Li Zhang Spring 28 Today Transformation in OpenGL Reading Chapter 3 Last time Primitive Details glpolygonmode(glenum face, GLenum mode); face:

More information

Getting Started. Overview (1): Getting Started (1): Getting Started (2): Getting Started (3): COSC 4431/5331 Computer Graphics.

Getting Started. Overview (1): Getting Started (1): Getting Started (2): Getting Started (3): COSC 4431/5331 Computer Graphics. Overview (1): Getting Started Setting up OpenGL/GLUT on Windows/Visual Studio COSC 4431/5331 Computer Graphics Thursday January 22, 2004 Overview Introduction Camera analogy Matrix operations and OpenGL

More information

Viewing and Projection

Viewing and Projection CSCI 480 Computer Graphics Lecture 5 Viewing and Projection January 25, 2012 Jernej Barbic University of Southern California Shear Transformation Camera Positioning Simple Parallel Projections Simple Perspective

More information

Describe the Orthographic and Perspective projections. How do we combine together transform matrices?

Describe the Orthographic and Perspective projections. How do we combine together transform matrices? Aims and objectives By the end of the lecture you will be able to Work with multiple transform matrices Describe the viewing process in OpenGL Design and build a camera control APIs Describe the Orthographic

More information

Geometry: Outline. Projections. Orthographic Perspective

Geometry: Outline. Projections. Orthographic Perspective Geometry: Cameras Outline Setting up the camera Projections Orthographic Perspective 1 Controlling the camera Default OpenGL camera: At (0, 0, 0) T in world coordinates looking in Z direction with up vector

More information

OpenGL Transformations

OpenGL Transformations OpenGL Transformations R. J. Renka Department of Computer Science & Engineering University of North Texas 02/18/2014 Introduction The most essential aspect of OpenGL is the vertex pipeline described in

More information

Transformation Pipeline

Transformation Pipeline Transformation Pipeline Local (Object) Space Modeling World Space Clip Space Projection Eye Space Viewing Perspective divide NDC space Normalized l d Device Coordinatesd Viewport mapping Screen space Coordinate

More information

Viewing Transformation

Viewing Transformation CS38: Computer Graphics Viewing Transformation Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg/ Class Objectives Know camera setup parameters Understand viewing and projection processes

More information

1 (Practice 1) Introduction to OpenGL

1 (Practice 1) Introduction to OpenGL 1 (Practice 1) Introduction to OpenGL This first practical is intended to get you used to OpenGL command. It is mostly a copy/paste work. Try to do it smartly by tweaking and messing around with parameters,

More information

Precept 2 Aleksey Boyko February 18, 2011

Precept 2 Aleksey Boyko February 18, 2011 Precept 2 Aleksey Boyko February 18, 2011 Getting started Initialization Drawing Transformations Cameras Animation Input Keyboard Mouse Joystick? Textures Lights Programmable pipeline elements (shaders)

More information

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

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

More information

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

CITSTUDENTS.IN VIEWING. Computer Graphics and Visualization. Classical and computer viewing. Viewing with a computer. Positioning of the camera UNIT - 6 7 hrs VIEWING Classical and computer viewing Viewing with a computer Positioning of the camera Simple projections Projections in OpenGL Hiddensurface removal Interactive mesh displays Parallelprojection

More information

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

3D Graphics for Game Programming (J. Han) Chapter II Vertex Processing Chapter II Vertex Processing Rendering Pipeline Main stages in the pipeline The vertex processing stage operates on every input vertex stored in the vertex buffer and performs various operations such as

More information

3.1 Viewing and Projection

3.1 Viewing and Projection Fall 2017 CSCI 420: Computer Graphics 3.1 Viewing and Projection Hao Li http://cs420.hao-li.com 1 Recall: Affine Transformations Given a point [xyz] > form homogeneous coordinates [xyz1] > The transformed

More information

Order of Transformations

Order of Transformations Order of Transformations Because the same transformation is applied to many vertices, the cost of forming a matrix M=ABCD is not significant compared to the cost of computing Mp for many vertices p Note

More information

CS380: Computer Graphics Viewing Transformation. Sung-Eui Yoon ( 윤성의 ) Course URL:

CS380: Computer Graphics Viewing Transformation. Sung-Eui Yoon ( 윤성의 ) Course URL: CS38: Computer Graphics Viewing Transformation Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg/ Class Objectives Know camera setup parameters Understand viewing and projection processes

More information

Computer Graphics. Bing-Yu Chen National Taiwan University

Computer Graphics. Bing-Yu Chen National Taiwan University Computer Graphics Bing-Yu Chen National Taiwan University Introduction to OpenGL General OpenGL Introduction An Example OpenGL Program Drawing with OpenGL Transformations Animation and Depth Buffering

More information

Viewing and Projection

Viewing and Projection 15-462 Computer Graphics I Lecture 5 Viewing and Projection Shear Transformation Camera Positioning Simple Parallel Projections Simple Perspective Projections [Angel, Ch. 5.2-5.4] January 30, 2003 [Red

More information

Transformations: 2D Transforms

Transformations: 2D Transforms 1. Translation Transformations: 2D Transforms Relocation of point WRT frame Given P = (x, y), translation T (dx, dy) Then P (x, y ) = T (dx, dy) P, where x = x + dx, y = y + dy Using matrix representation

More information

The View Frustum. Lecture 9 Sections 2.6, 5.1, 5.2. Robb T. Koether. Hampden-Sydney College. Wed, Sep 14, 2011

The View Frustum. Lecture 9 Sections 2.6, 5.1, 5.2. Robb T. Koether. Hampden-Sydney College. Wed, Sep 14, 2011 The View Frustum Lecture 9 Sections 2.6, 5.1, 5.2 Robb T. Koether Hampden-Sydney College Wed, Sep 14, 2011 Robb T. Koether (Hampden-Sydney College) The View Frustum Wed, Sep 14, 2011 1 / 36 Outline 1 The

More information

Lecture 5: Viewing. CSE Computer Graphics (Fall 2010)

Lecture 5: Viewing. CSE Computer Graphics (Fall 2010) Lecture 5: Viewing CSE 40166 Computer Graphics (Fall 2010) Review: from 3D world to 2D pixels 1. Transformations are represented by matrix multiplication. o Modeling o Viewing o Projection 2. Clipping

More information

Interaction Computer Graphics I Lecture 3

Interaction Computer Graphics I Lecture 3 15-462 Computer Graphics I Lecture 3 Interaction Client/Server Model Callbacks Double Buffering Hidden Surface Removal Simple Transformations January 21, 2003 [Angel Ch. 3] Frank Pfenning Carnegie Mellon

More information

Modeling Transform. Chapter 4 Geometric Transformations. Overview. Instancing. Specify transformation for objects 李同益

Modeling Transform. Chapter 4 Geometric Transformations. Overview. Instancing. Specify transformation for objects 李同益 Modeling Transform Chapter 4 Geometric Transformations 李同益 Specify transformation for objects Allow definitions of objects in own coordinate systems Allow use of object definition multiple times in a scene

More information

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

Overview. Viewing and perspectives. Planar Geometric Projections. Classical Viewing. Classical views Computer viewing Perspective normalization Overview Viewing and perspectives Classical views Computer viewing Perspective normalization Classical Viewing Viewing requires three basic elements One or more objects A viewer with a projection surface

More information

Computer Graphics. Viewing. Fundamental Types of Viewing. Perspective views. Parallel views. October 12, finite COP (center of projection)

Computer Graphics. Viewing. Fundamental Types of Viewing. Perspective views. Parallel views. October 12, finite COP (center of projection) Comuter Grahics Viewing October 2, 25 htt://www.hallm.ac.kr/~sunkim/teach/25/cga Funamental Tes of Viewing Persective views finite COP (center of rojection) Parallel views COP at infinit DOP (irection

More information

Spring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013

Spring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013 Spring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013 PROJECT GOAL: Write a restricted OpenGL library. The goal of the project is to compute all the transformation matrices with your

More information

Fachhochschule Regensburg, Germany, February 15, 2017

Fachhochschule Regensburg, Germany, February 15, 2017 s Operations Fachhochschule Regensburg, Germany, February 15, 2017 s Motivating Example s Operations To take a photograph of a scene: Set up your tripod and point camera at the scene (Viewing ) Position

More information

Introduction to OpenGL Transformations, Viewing and Lighting. Ali Bigdelou

Introduction to OpenGL Transformations, Viewing and Lighting. Ali Bigdelou Introduction to OpenGL Transformations, Viewing and Lighting Ali Bigdelou Modeling From Points to Polygonal Objects Vertices (points) are positioned in the virtual 3D scene Connect points to form polygons

More information

Computer graphics MN1

Computer graphics MN1 Computer graphics MN1 http://www.opengl.org Todays lecture What is OpenGL? How do I use it? Rendering pipeline Points, vertices, lines,, polygons Matrices and transformations Lighting and shading Code

More information

Computer Viewing. CITS3003 Graphics & Animation. E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley

Computer Viewing. CITS3003 Graphics & Animation. E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley Computer Viewing CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 1 Objectives Introduce the mathematics of projection Introduce OpenGL viewing

More information

Matrix-Rechnung I ' z =... Universität Frankfurt

Matrix-Rechnung I ' z =... Universität Frankfurt Matrix-Rechnung I x =Ax = = 1.................................... ' ' ' ' ' 44 41 14 11 z y x a a a a w z y x Matrix-Rechnung II Matrixmultiplikation ist assoziativ, abernicht kommutativ. OpenGL multipliziert

More information

Three-Dimensional Graphics III. Guoying Zhao 1 / 67

Three-Dimensional Graphics III. Guoying Zhao 1 / 67 Computer Graphics Three-Dimensional Graphics III Guoying Zhao 1 / 67 Classical Viewing Guoying Zhao 2 / 67 Objectives Introduce the classical views Compare and contrast image formation by computer with

More information

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

7. 3D Viewing. Projection: why is projection necessary? CS Dept, Univ of Kentucky 7. 3D Viewing Projection: why is projection necessary? 1 7. 3D Viewing Projection: why is projection necessary? Because the display surface is 2D 2 7.1 Projections Perspective projection 3 7.1 Projections

More information

Interaction. CSCI 480 Computer Graphics Lecture 3

Interaction. CSCI 480 Computer Graphics Lecture 3 CSCI 480 Computer Graphics Lecture 3 Interaction January 18, 2012 Jernej Barbic University of Southern California Client/Server Model Callbacks Double Buffering Hidden Surface Removal Simple Transformations

More information

CIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011

CIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011 CIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011 Lab 1a of 7 OpenGL Setup and Basics Fri 28 Jan 2011 Part 1a (#1 5) due: Thu 03 Feb 2011 (before midnight) The purpose of this

More information

Windows and Viewports. Windows and Viewports. Windows and Viewports. Windows and Viewports. CSC 706 Computer Graphics

Windows and Viewports. Windows and Viewports. Windows and Viewports. Windows and Viewports. CSC 706 Computer Graphics CSC 706 Computer Graphics World World Window, Screen Window and Viewport Setting Window and Viewport automatically Tiling Previously we looked at an OpenGL window where x and y were plotted as positive

More information

Advanced Computer Graphics (CS & SE )

Advanced Computer Graphics (CS & SE ) Advanced Computer Graphics (CS & SE 233.420) Topics Covered Picking Pipeline Viewing and Transformations Rendering Modes OpenGL can render in one of three modes selected by glrendermode(mode) GL_RENDER

More information

Computer Graphics. Transformations. CSC 470 Computer Graphics 1

Computer Graphics. Transformations. CSC 470 Computer Graphics 1 Computer Graphics Transformations CSC 47 Computer Graphics 1 Today s Lecture Transformations How to: Rotate Scale and Translate 2 Introduction An important concept in computer graphics is Affine Transformations.

More information

MORE OPENGL. Pramook Khungurn CS 4621, Fall 2011

MORE OPENGL. Pramook Khungurn CS 4621, Fall 2011 MORE OPENGL Pramook Khungurn CS 4621, Fall 2011 SETTING UP THE CAMERA Recall: OpenGL Vertex Transformations Coordinates specified by glvertex are transformed. End result: window coordinates (in pixels)

More information

Transformation, Input and Interaction. Hanyang University

Transformation, Input and Interaction. Hanyang University Transformation, Input and Interaction Hanyang University Transformation, projection, viewing Pipeline of transformations Standard sequence of transforms Cornell CS4620 Fall 2008 Lecture 8 3 2008 Steve

More information

Lecture 9 Sections 2.6, 5.1, 5.2. Wed, Sep 16, 2009

Lecture 9 Sections 2.6, 5.1, 5.2. Wed, Sep 16, 2009 Lecture 9 Sections 2.6, 5.1, 5.2 Hampden-Sydney College Wed, Sep 16, 2009 Outline 1 2 3 4 5 6 Controlling 7 Definition () A frustum is a truncated pyramid. Definition ( ) The view frustum is the region

More information

Lecture 4 of 41. Lab 1a: OpenGL Basics

Lecture 4 of 41. Lab 1a: OpenGL Basics Lab 1a: OpenGL Basics William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://snipurl.com/1y5gc Course web site: http://www.kddresearch.org/courses/cis636 Instructor

More information

Quaternion Rotations AUI Course Denbigh Starkey

Quaternion Rotations AUI Course Denbigh Starkey Major points of these notes: Quaternion Rotations AUI Course Denbigh Starkey. What I will and won t be doing. Definition of a quaternion and notation 3 3. Using quaternions to rotate any point around an

More information

CS D Transformation. Junqiao Zhao 赵君峤

CS D Transformation. Junqiao Zhao 赵君峤 CS10101001 3D Transformation Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Review Translation Linear transformation

More information

COMP Computer Graphics and Image Processing. 5: Viewing 1: The camera. In part 1 of our study of Viewing, we ll look at ˆʹ U ˆ ʹ F ˆʹ S

COMP Computer Graphics and Image Processing. 5: Viewing 1: The camera. In part 1 of our study of Viewing, we ll look at ˆʹ U ˆ ʹ F ˆʹ S COMP27112 Û ˆF Ŝ Computer Graphics and Image Processing ˆʹ U ˆ ʹ F C E 5: iewing 1: The camera ˆʹ S Toby.Howard@manchester.ac.uk 1 Introduction In part 1 of our study of iewing, we ll look at iewing in

More information

Wire-Frame 3D Graphics Accelerator IP Core. C Library Specification

Wire-Frame 3D Graphics Accelerator IP Core. C Library Specification Wire-Frame 3D Graphics Accelerator IP Core C Library Specification Kenji Ishimaru 1 / 29 Revision History Rev. Date Author Description 1.0 2015/09/30 Kenji Ishimaru First release

More information

OpenGL Tutorial. Ceng 477 Introduction to Computer Graphics

OpenGL Tutorial. Ceng 477 Introduction to Computer Graphics OpenGL Tutorial Ceng 477 Introduction to Computer Graphics Adapted from: http://www.cs.princeton.edu/courses/archive/spr06/cos426/assn3/opengl_tutorial.ppt OpenGL IS an API OpenGL IS nothing more than

More information

3D computer graphics: geometric modeling of objects in the computer and rendering them

3D computer graphics: geometric modeling of objects in the computer and rendering them SE313: Computer Graphics and Visual Programming Computer Graphics Notes Gazihan Alankus, Spring 2012 Computer Graphics 3D computer graphics: geometric modeling of objects in the computer and rendering

More information

Introduction to OpenGL

Introduction to OpenGL Introduction to OpenGL Tutorial 1: Create a window and draw a 2D square Introduction: The aim of the first tutorial is to introduce you to the magic world of graphics based on the OpenGL and GLUT APIs.

More information

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

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment Notes on Assignment Notes on Assignment Objects on screen - made of primitives Primitives are points, lines, polygons - watch vertex ordering The main object you need is a box When the MODELVIEW matrix

More information

2D and 3D Viewing Basics

2D and 3D Viewing Basics CS10101001 2D and 3D Viewing Basics Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Viewing Analog to the physical viewing

More information

Computer Graphics 7: Viewing in 3-D

Computer Graphics 7: Viewing in 3-D Computer Graphics 7: Viewing in 3-D In today s lecture we are going to have a look at: Transformations in 3-D How do transformations in 3-D work? Contents 3-D homogeneous coordinates and matrix based transformations

More information

CS 4204 Computer Graphics

CS 4204 Computer Graphics CS 4204 Computer Graphics GLUT (Continue) More Interactions Yong Cao Virginia Tech References: Interactive Computer Graphics, Fourth Edition, Ed Angle Orthographical Projection Synthetic camera model View

More information

Visualizing Molecular Dynamics

Visualizing Molecular Dynamics Visualizing Molecular Dynamics Aiichiro Nakano Collaboratory for Advanced Computing & Simulations Department of Computer Science Department of Physics & Astronomy Department of Chemical Engineering & Materials

More information

Computer Graphics (Basic OpenGL)

Computer Graphics (Basic OpenGL) Computer Graphics (Basic OpenGL) Thilo Kielmann Fall 2008 Vrije Universiteit, Amsterdam kielmann@cs.vu.nl http://www.cs.vu.nl/ graphics/ Computer Graphics (Basic OpenGL, Input and Interaction), ((57))

More information

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

Computer Viewing. Prof. George Wolberg Dept. of Computer Science City College of New York Computer Viewing Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Introduce the mathematics of projection Introduce OpenGL viewing functions Look at alternate viewing

More information

3.2 Hierarchical Modeling

3.2 Hierarchical Modeling Fall 2018 CSCI 420: Computer Graphics 3.2 Hierarchical Modeling Hao Li http://cs420.hao-li.com 1 Importance of shadows Source: UNC 2 Importance of shadows Source: UNC 3 Importance of shadows Source: UNC

More information

Hidden Surface Removal. 3D Graphics with OpenGL. Back-Face Culling

Hidden Surface Removal. 3D Graphics with OpenGL. Back-Face Culling Hidden Surface Removal Back Face Culling 3D Surfaces Bicubic Parametric Bezier Surface Patches 3D Graphics with OpenGL Back-Face Culling Define one side of each polygon to be the visible side That side

More information

COMS 4160: Problems on Transformations and OpenGL

COMS 4160: Problems on Transformations and OpenGL COMS 410: Problems on Transformations and OpenGL Ravi Ramamoorthi 1. Write the homogeneous 4x4 matrices for the following transforms: Translate by +5 units in the X direction Rotate by 30 degrees about

More information

CS 4204 Computer Graphics

CS 4204 Computer Graphics CS 4204 Computer Graphics 3D Viewing and Projection Yong Cao Virginia Tech Objective We will develop methods to camera through scenes. We will develop mathematical tools to handle perspective projection.

More information

Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D

Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D CS334 Spring 2012 Daniel G. Aliaga Department of Computer Science Purdue University Computer Graphics Pipeline Geometric Primitives

More information

Modeling Objects by Polygonal Approximations. Linear and Affine Transformations (Maps)

Modeling Objects by Polygonal Approximations. Linear and Affine Transformations (Maps) Modeling Objects by Polygonal Approximations Define volumetric objects in terms of surfaces patches that surround the volume Each surface patch is approximated set of polygons Each polygon is specified

More information

Scientific Visualization Basics

Scientific Visualization Basics Scientific Visualization Basics Aiichiro Nakano Collaboratory for Advanced Computing & Simulations Dept. of Computer Science, Dept. of Physics & Astronomy, Dept. of Chemical Engineering & Materials Science,

More information

CSC 470 Computer Graphics

CSC 470 Computer Graphics CSC 470 Computer Graphics Transformations of Objects CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 1 Transformations of objects - 2D CSC 470 Computer Graphics, Dr.N. Georgieva, CSI/CUNY 2 Using

More information

Project Sketchpad. Ivan Sutherland (MIT 1963) established the basic interactive paradigm that characterizes interactive computer graphics:

Project Sketchpad. Ivan Sutherland (MIT 1963) established the basic interactive paradigm that characterizes interactive computer graphics: Project Sketchpad Ivan Sutherland (MIT 1963) established the basic interactive paradigm that characterizes interactive computer graphics: User sees an object on the display User points to (picks) the object

More information

Lecture 4. Viewing, Projection and Viewport Transformations

Lecture 4. Viewing, Projection and Viewport Transformations Notes on Assignment Notes on Assignment Hw2 is dependent on hw1 so hw1 and hw2 will be graded together i.e. You have time to finish both by next monday 11:59p Email list issues - please cc: elif@cs.nyu.edu

More information

Jorg s Graphics Lecture Notes Coordinate Spaces 1

Jorg s Graphics Lecture Notes Coordinate Spaces 1 Jorg s Graphics Lecture Notes Coordinate Spaces Coordinate Spaces Computer Graphics: Objects are rendered in the Euclidean Plane. However, the computational space is better viewed as one of Affine Space

More information

Introduction to 3D Graphics with OpenGL. Z-Buffer Hidden Surface Removal. Binghamton University. EngiNet. Thomas J. Watson

Introduction to 3D Graphics with OpenGL. Z-Buffer Hidden Surface Removal. Binghamton University. EngiNet. Thomas J. Watson Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced

More information

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

Evening s Goals. Mathematical Transformations. Discuss the mathematical transformations that are utilized for computer graphics Evening s Goals Discuss the mathematical transformations that are utilized for computer graphics projection viewing modeling Describe aspect ratio and its importance Provide a motivation for homogenous

More information

Getting Started. 1 st Week, Sun-Jeong Kim. Computer Graphics Applications

Getting Started. 1 st Week, Sun-Jeong Kim. Computer Graphics Applications OpenGL Programming Getting Started 1 st Week, 2008 Sun-Jeong Kim Visual Studio 2005 Windows Programming 2 Visual C++ Win32 Application New Project 3 Empty project Application Settings 4 Solution Prac01

More information

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

Chap 3 Viewing Pipeline Reading: Angel s Interactive Computer Graphics, Sixth ed. Sections 4.1~4.7 Chap 3 Viewing Pipeline Reading: Angel s Interactive Computer Graphics, Sixth ed. Sections 4.~4.7 Chap 3 View Pipeline, Comp. Graphics (U) CGGM Lab., CS Dept., NCTU Jung Hong Chuang Outline View parameters

More information

Graphics and Visualization

Graphics and Visualization International University Bremen Spring Semester 2006 Recap Representing graphic objects by homogenous points and vectors Using affine transforms to modify objects Using projections to display objects

More information

Chapter 3: Modeling Transformation

Chapter 3: Modeling Transformation Chapter 3: Modeling Transformation Graphics Programming, 8th Sep. Graphics and Media Lab. Seoul National University 2011 Fall OpenGL Steps Every step in the graphics pipeline is related to the transformation.

More information

5.8.3 Oblique Projections

5.8.3 Oblique Projections 278 Chapter 5 Viewing y (, y, ) ( p, y p, p ) Figure 537 Oblique projection P = 2 left right 0 0 left+right left right 0 2 top bottom 0 top+bottom top bottom far+near far near 0 0 far near 2 0 0 0 1 Because

More information

CSCI E-74. Simulation and Gaming

CSCI E-74. Simulation and Gaming CSCI E-74 Virtual and Augmented Reality for Simulation and Gaming Fall term 2017 Gianluca De Novi, PhD Lesson 3 General Introduction to OpenGL APIs and TRS Perspective Simulation Perspective simulation

More information

Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt

Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt CS334 Fall 2015 Daniel G. Aliaga Department of Computer Science Purdue University Books (and by now means complete ) Interactive Computer

More information

Graphics Programming. August 31, Programming of the Sierpinski gasket. Programming with OpenGL and C/C++

Graphics Programming. August 31, Programming of the Sierpinski gasket. Programming with OpenGL and C/C++ Computer Graphics Graphics Programming August 31, 2005 Contents Our Goal in This Chapter Programming of the Sierpinski gasket How To? Programming with OpenGL and C/C++ OpenGL API (Application Programmer

More information

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

Projection: Mapping 3-D to 2-D. Orthographic Projection. The Canonical Camera Configuration. Perspective Projection Projection: Mapping 3-D to 2-D Our scene models are in 3-D space and images are 2-D so we need some wa of projecting 3-D to 2-D The fundamental approach: planar projection first, we define a plane in 3-D

More information

QUESTION 1 [10] 2 COS340-A October/November 2009

QUESTION 1 [10] 2 COS340-A October/November 2009 2 COS340-A QUESTION 1 [10] a) OpenGL uses z-buffering for hidden surface removal. Explain how the z-buffer algorithm works and give one advantage of using this method. (5) Answer: OpenGL uses a hidden-surface

More information

Today s class. Viewing transformation Menus Mandelbrot set and pixel drawing. Informationsteknologi

Today s class. Viewing transformation Menus Mandelbrot set and pixel drawing. Informationsteknologi Today s class Viewing transformation Menus Mandelbrot set and pixel drawing Monday, November 2, 27 Computer Graphics - Class 7 The world & the window World coordinates describe the coordinate system used

More information

UNIT 7 LIGHTING AND SHADING. 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M

UNIT 7 LIGHTING AND SHADING. 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M UNIT 7 LIGHTING AND SHADING 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M Ans: Phong developed a simple model that can be computed rapidly It considers three

More information

3D Viewing Episode 2

3D Viewing Episode 2 3D Viewing Episode 2 1 Positioning and Orienting the Camera Recall that our projection calculations, whether orthographic or frustum/perspective, were made with the camera at (0, 0, 0) looking down the

More information

Outline. Other Graphics Technology. OpenGL Background and History. Platform Specifics. The Drawing Process

Outline. Other Graphics Technology. OpenGL Background and History. Platform Specifics. The Drawing Process Outline 433-380 Graphics and Computation Introduction to OpenGL OpenGL Background and History Other Graphics Technology Drawing Viewing and Transformation Lighting GLUT Resources Some images in these slides

More information

Graphics and Computation Introduction to OpenGL

Graphics and Computation Introduction to OpenGL 433-380 Graphics and Computation Introduction to OpenGL Some images in these slides are taken from The OpenGL Programming Manual, which is copyright Addison Wesley and the OpenGL Architecture Review Board.

More information

Viewing COMPSCI 464. Image Credits: Encarta and

Viewing COMPSCI 464. Image Credits: Encarta and Viewing COMPSCI 464 Image Credits: Encarta and http://www.sackville.ednet.ns.ca/art/grade/drawing/perspective4.html Graphics Pipeline Graphics hardware employs a sequence of coordinate systems The location

More information

Reminder: Affine Transformations. Viewing and Projection. Shear Transformations. Transformation Matrices in OpenGL. Specification via Ratios

Reminder: Affine Transformations. Viewing and Projection. Shear Transformations. Transformation Matrices in OpenGL. Specification via Ratios CSCI 420 Computer Graphics Lecture 6 Viewing and Projection Jernej Barbic University o Southern Caliornia Shear Transormation Camera Positioning Simple Parallel Projections Simple Perspective Projections

More information

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CSE528 Computer Graphics: Theory, Algorithms, and Applications CSE528 Computer Graphics: Theory, Algorithms, and Applications Hong Qin Stony Brook University (SUNY at Stony Brook) Stony Brook, New York 11794-2424 Tel: (631)632-845; Fax: (631)632-8334 qin@cs.stonybrook.edu

More information

C OMPUTER G RAPHICS Thursday

C OMPUTER G RAPHICS Thursday C OMPUTER G RAPHICS 2017.04.27 Thursday Professor s original PPT http://calab.hanyang.ac.kr/ Courses Computer Graphics practice3.pdf TA s current PPT not uploaded yet GRAPHICS PIPELINE What is Graphics

More information

12. Selection. - The objects selected are specified by hit records in the selection buffer. E.R. Bachmann & P.L. McDowell MV 4202 Page 1 of 13

12. Selection. - The objects selected are specified by hit records in the selection buffer. E.R. Bachmann & P.L. McDowell MV 4202 Page 1 of 13 12. Selection Picking is a method of capturing mouse clicks at some window position and determining what objects are beneath it. The basic idea is to enter the selection rendering mode with a small viewing

More information

OpenGL. 1 OpenGL OpenGL 1.2 3D. (euske) 1. Client-Server Model OpenGL

OpenGL. 1 OpenGL OpenGL 1.2 3D. (euske) 1. Client-Server Model OpenGL OpenGL (euske) 1 OpenGL - 1.1 OpenGL 1. Client-Server Model 2. 3. 1.2 3D OpenGL (Depth-Buffer Algorithm Z-Buffer Algorithm) (polygon ) ( rendering) Client-Server Model X Window System ( GL ) GL (Indy O

More information