Transformations IV Week 3, Wed Jan 20

Slides:



Advertisements
Similar presentations
Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutWireCube glutWireCone gluCylinder glutWireTeapot.
Advertisements

CLASS 4 CS770/870. Translation Scale Multiplying Matrices. The R C rule What happens when we do two translates? What happens when we do two scales?
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Transformations III Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Display Lists, Viewing.
University of British Columbia CPSC 314 Computer Graphics May-June 2005 Tamara Munzner Transformations I, II,
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations III Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections I.
Math 1Hofstra University – CSC171A1 Modeling Objects by Polygonal Approximations Define volumetric objects in terms of surfaces patches that surround the.
Transformations II Week 2, Wed Jan 17
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
Transformations IV Week 3, Wed Jan 23
© Tamara Munzner University of British Columbia Hierarchical modelling recap: composing transforms recap: composing transforms finish: rendering pipeline.
Modeling Objects by Polygonal Approximations
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Transformations V Week.
University of British Columbia CPSC 414 Computer Graphics Week 3, Monday 15 Oct 03 © Tamara Munzner 1 Hierarchies, Display Lists recap: matrix hierarchies,
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Transformations III Week.
2D Transformations. World Coordinates Translate Rotate Scale Viewport Transforms Hierarchical Model Transforms Putting it all together.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
Hierarchical Transformations Hierarchical Models Scene Graphs
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 2: Review of Basic Math
TWO DIMENSIONAL GEOMETRIC TRANSFORMATIONS CA 302 Computer Graphics and Visual Programming Aydın Öztürk
Graphics Graphics Korea University kucg.korea.ac.kr Transformations 고려대학교 컴퓨터 그래픽스 연구실.
Geometric Transformations Jehee Lee Seoul National University.
Geometric transformations The Pipeline
Transforms Hierarchical Modeling Scene Graphs Using hierarchical modeling techniques in 3D software design Transforms Local basis Matrix math review Matrices.
Week 4 Lecture 1: Hierarchical Modeling Part 1 Based on Interactive Computer Graphics (Angel) - Chapter 10 1 Angel: Interactive Computer Graphics 5E ©
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
1/50 CS148: Introduction to Computer Graphics and Imaging Transforms CS148: Introduction to Computer Graphics and Imaging Transforms.
2 COEN Computer Graphics I Evening’s Goals n Discuss viewing and modeling transformations n Describe matrix stacks and their uses n Show basic geometric.
Geometric Transformations
Transformations
Geometric Transformations Sang Il Park Sejong University Many slides come from Jehee Lee’s.
University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Hierarchical Modeling.
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
1 Geometric Transformations-II Modelling Transforms By Dr.Ureerat Suksawatchon.
1 Dr. Scott Schaefer 3D Transformations. 2/149 Review – Vector Operations Dot Product.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
CSCE 441: Computer Graphics: Hierarchical Models Jinxiang Chai.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
Final Review I University of British Columbia
CSE 167 [Win 17], Lecture 3: Transformations 1 Ravi Ramamoorthi
Math Fundamentals Maths revisit.
Transformations 5 University of British Columbia
Computer Graphics CC416 Week 15 3D Graphics.
Transformations V, Viewing I Week 3, Fri Jan 22
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.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016
Transformation and Viewing
Computer Graphics - Hierarchical Models-
Hierarchical and Object-Oriented Graphics
Transformations 6 University of British Columbia
Transformations 3 University of British Columbia
Hierarchical and Object-Oriented Graphics
Transformations 4 University of British Columbia
Transformations 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
The Modelview Matrix Lecture 8 Mon, Sep 10, 2007.
Transformations in OpenGL
Geometric Objects and Transformations (II)
Transformations IV Week 3, Mon Jan 22
Transformations III Week 3, Mon Jan 21
Transformations II Week 2, Fri Jan 18
CSCE441: Computer Graphics 2D/3D Transformations
Viewing/Projections I Week 3, Fri Jan 25
Transformations IV Week 3, Wed Jan 23
Hierarchical Modeling
CSCE 441: Computer Graphics: Hierarchical Models
Presentation transcript:

Transformations IV Week 3, Wed Jan 20 http://www.ugrad.cs.ubc.ca/~cs314/Vjan2010

Assignments

Correction: Assignments project 1 out today, due 5pm sharp Fri Jan 29 projects will go out before we’ve covered all the material so you can think about it before diving in template code gives you program shell and build tools now out: separate packages for Linux, Mac, Windows see http://www.ugrad.cs.ubc.ca/~cs314/Vjan2010/#assign p1_template_linux.tar.gz p1_template_mac.tar.gz p1_template_win.zip written homework 1 theoretical side of material

Demo animal out of boxes and matrices

Real Iguanas http://funkman.org/animal/reptile/iguana1.jpg jpg http://www.naturephoto-cz.com/photos/sevcik/ green-iguana--iguana-iguana-1.jpg http://www.mccullagh.org/db9/d30-3/iguana-closeup.jpg

Review: Arbitrary Rotation C A (bx, by, bz, 1) Y Z X B C A Y Z X (ax, ay, az, 1) (cx, cy, cz, 1) arbitrary rotation: change of basis given two orthonormal coordinate systems XYZ and ABC A’s location in the XYZ coordinate system is (ax, ay, az, 1), ... transformation from one to the other is matrix R whose columns are A,B,C:

Review: Transformation Hierarchies scene may have a hierarchy of coordinate systems stores matrix at each level with incremental transform from parent’s coordinate system scene graph road stripe1 stripe2 ... car1 car2 w1 w3 w2 w4

Review: Matrix Stacks D = C scale(2,2,2) trans(1,0,0) A B C D glPushMatrix() glPopMatrix() A B C DrawSquare() A B C A B C glPushMatrix() glScale3f(2,2,2) glTranslate3f(1,0,0) DrawSquare() glPopMatrix()

Transformation Hierarchy Example 3 Fh Fh glLoadIdentity(); glTranslatef(4,1,0); glPushMatrix(); glRotatef(45,0,0,1); glTranslatef(0,2,0); glScalef(2,1,1); glTranslate(1,0,0); glPopMatrix(); Fh Fh Fh Fh Fh F1 FW

Transformation Hierarchy Example 4 glTranslate3f(x,y,0); glRotatef( ,0,0,1); DrawBody(); glPushMatrix(); glTranslate3f(0,7,0); DrawHead(); glPopMatrix(); glTranslate(2.5,5.5,0); DrawUArm(); glTranslate(0,-3.5,0); DrawLArm(); ... (draw other arm) y x

Hierarchical Modelling advantages define object once, instantiate multiple copies transformation parameters often good control knobs maintain structural constraints if well-designed limitations expressivity: not always the best controls can’t do closed kinematic chains keep hand on hip can’t do other constraints collision detection self-intersection walk through walls

Display Lists

Display Lists precompile/cache block of OpenGL code for reuse usually more efficient than immediate mode exact optimizations depend on driver good for multiple instances of same object but cannot change contents, not parametrizable good for static objects redrawn often display lists persist across multiple frames interactive graphics: objects redrawn every frame from new viewpoint from moving camera can be nested hierarchically snowman example http://www.lighthouse3d.com/opengl/displaylists

One Snowman void drawSnowMan() { glColor3f(1.0f, 1.0f, 1.0f); // Draw Body glTranslatef(0.0f ,0.75f, 0.0f); glutSolidSphere(0.75f,20,20); // Draw Head glTranslatef(0.0f, 1.0f, 0.0f); glutSolidSphere(0.25f,20,20); // Draw Eyes glPushMatrix(); glColor3f(0.0f,0.0f,0.0f); glTranslatef(0.05f, 0.10f, 0.18f); glutSolidSphere(0.05f,10,10); glTranslatef(-0.1f, 0.0f, 0.0f); glutSolidSphere(0.05f,10,10); glPopMatrix(); // Draw Nose glColor3f(1.0f, 0.5f , 0.5f); glRotatef(0.0f,1.0f, 0.0f, 0.0f); glutSolidCone(0.08f,0.5f,10,2); }

Instantiate Many Snowmen // Draw 36 Snowmen for(int i = -3; i < 3; i++) for(int j=-3; j < 3; j++) { glPushMatrix(); glTranslatef(i*10.0, 0, j * 10.0); // Call the function to draw a snowman drawSnowMan(); glPopMatrix(); } 36K polygons, 55 FPS

Making Display Lists 36K polygons, 153 FPS GLuint createDL() { GLuint snowManDL; // Create the id for the list snowManDL = glGenLists(1); glNewList(snowManDL,GL_COMPILE); drawSnowMan(); glEndList(); return(snowManDL); } snowmanDL = createDL(); for(int i = -3; i < 3; i++) for(int j=-3; j < 3; j++) { glPushMatrix(); glTranslatef(i*10.0, 0, j * 10.0); glCallList(Dlid); glPopMatrix(); } 36K polygons, 153 FPS

Transforming Normals

Transforming Geometric Objects lines, polygons made up of vertices transform the vertices interpolate between does this work for everything? no! normals are trickier

Computing Normals normal direction specifying orientation of polygon w=0 means direction with homogeneous coords vs. w=1 for points/vectors of object vertices used for lighting must be normalized to unit length can compute if not supplied with object

Transforming Normals so if points transformed by matrix M, can we just transform normal vector by M too? translations OK: w=0 means unaffected rotations OK uniform scaling OK these all maintain direction

Transforming Normals nonuniform scaling does not work x-y=0 plane line x=y normal: [1,-1,0] direction of line x=-y (ignore normalization for now)

Transforming Normals apply nonuniform scale: stretch along x by 2 new plane x = 2y transformed normal: [2,-1,0] normal is direction of line x = -2y or x+2y=0 not perpendicular to plane! should be direction of 2x = -y

Planes and Normals plane is all points perpendicular to normal (with dot product) (matrix multiply requires transpose) explicit form: plane =

Finding Correct Normal Transform transform a plane given M, what should Q be? stay perpendicular substitute from above thus the normal to any surface can be transformed by the inverse transpose of the modelling transformation