Hierarchical and Object-Oriented Graphics

Slides:



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

Animation Following “Advanced Animation and Rendering Techniques” (chapter 15+16) By Agata Przybyszewska.
Hierarchical Modeling I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Transformations Objectives Understand how transformations work in 2D and 3D Understand the concept of homogenous coordinate system Understand scene graphs.
Hierarchical Modeling II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Animation. Outline  Key frame animation  Hierarchical animation  Inverse kinematics.
Graphical Objects and Scene Graphs CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
2D Transformations. World Coordinates Translate Rotate Scale Viewport Transforms Hierarchical Model Transforms Putting it all together.
Hierarchical Transformations and Models CSE 3541 Matt Boggus.
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
Hierarchy, Modeling, and Scene Graphs Angel: Chapter 10 OpenGL Programming and Reference Guides, other sources. ppt from Angel, AW, etc. CSCI 6360/4360.
COMP 175: Computer Graphics March 10, 2015
Objectives Review some advanced topics, including Review some advanced topics, including Chapter 8: Implementation Chapter 8: Implementation Chapter 9:
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Kinematic Linkages.
Chapter 10 Bresenham’s Algorithm Data Structures and Graphics or Working with Models.
1 Animation & Java3D ©Anthony Steed Overview n Introduction to Animation Kinematics Dynamics Boids n Java3D Scene graph Animation Vehicles.
Graphical Objects and Scene Graphs 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
Demetriou/Loizidou – ACSC330 – Chapter 9 Hierarchical and Object-Oriented Modeling Dr. Giorgos A. Demetriou Dr. Stephania Loizidou Himona Computer Science.
Data Structures for Scenes, The Basics of Scene Graphs Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday,
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Kinematic Linkages.
Implementing Scene Graphs, CSG Trees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, January 26, 2004.
Week 4 Lecture 1: Hierarchical Modeling Part 1 Based on Interactive Computer Graphics (Angel) - Chapter 10 1 Angel: Interactive Computer Graphics 5E ©
Hierarchical Modeling. Instance Transformation Start with a prototype object (a symbol) Each appearance of the object in the model is an instance – Must.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 40 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 40 Computer Graphics Hierarchy I.
Geometry: 2-D Transformations Course web page: Chapter #3.
Kinematics Jehee Lee Seoul National University. Kinematics How to animate skeletons (articulated figures) Kinematics is the study of motion without regard.
Jul 25, 2014IAT 3551 Scene Graphs.  A data structure that stores information about a graphics scene –Each node has information that structures the interpretation.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Hierarchical and Object-Oriented Graphics Construct complex models from a set of simple geometric objects Extend the use of transformations to include.
Transformations Tutorial
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.
Computer Graphics I, Fall 2008 Hierarchical Modeling II.
Computer Graphics Matrix Hierarchies / Animation
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 9.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Hierarchical Modeling.
Graphical Objects and Scene Graphs Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Hierarchical Modeling. 2 Objectives Build a tree-structured model of a humanoid figure. Examine various traversal strategies. Build a generalized tree-model.
CS559: Computer Graphics Lecture 13: Hierarchical Modeling and Curves Li Zhang Spring 2010.
1 Geometric Transformations-II Modelling Transforms By Dr.Ureerat Suksawatchon.
Computer Graphics I, Fall 2008 Hierarchical Modeling I.
CSCE 441: Computer Graphics: Hierarchical Models Jinxiang Chai.
Rotation about Arbitrary Axis oOften we need rotation about a vector U that is not a coordinate axis (not X, nor Y, nor Z) and may not pass through the.
Hierarchical Models Chapter 9.
IAT 355 Scene Graphs Feb 23, 2017 IAT 355.
Graphical Objects and Scene Graphs
Graphical Objects and Scene Graphs
Modeling and Hierarchy
Hierarchical Modeling II
Hierarchical Transformations Hierarchical Models Scene Graphs
CHAPTER 2 FORWARD KINEMATIC 1.
Computer Graphics - Hierarchical Models-
Mobile Robot Kinematics
Modeling and Hierarchy
Hierarchical and Object-Oriented Graphics
Introduction to Computer Graphics with WebGL
CSCE 441: Computer Graphics: Hierarchical Models
Unit-5 Geometric Objects and Transformations-II
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
Transformations IV Week 3, Wed Jan 20
Hierarchical Modeling I
Transformations in OpenGL
Hierarchical Modeling & Constructive Solid Geometry
Geometric Objects and Transformations (II)
Dr. Chih-Kuo Yeh 葉智國 Computer Graphics Dr. Chih-Kuo Yeh 葉智國
Hierarchical Modeling
Computer Graphics Matrix Hierarchies / Animation
CSCE 441: Computer Graphics: Hierarchical Models
Presentation transcript:

Hierarchical and Object-Oriented Graphics Chapter 8

Chapter 8 -- Hierarchical and Object-Oriented Graphics Introduction: In this chapter we explore multiple approaches to developing and working with models of geometric objects. We extend the use of transformations from Chapter 4 to include hierarchical relationships among the objects. The techniques that we develop are appropriate for applications, such as robotics and figure animation, where the dynamic behavior of the objects is characterized by relationships among the parts of the model. CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics The notion of hierarchy is a powerful one and is an integral part of object oriented methodologies. We extend our hierarchical model of objects to hierarchical models of whole scenes, including cameras, lights, and material properties. Such models allow us to extend our graphics APIs to more objet-oriented systems and gives us insight in how to use graphics over networks and distributed environments, such as the Web. CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 1. Symbols and Instances Our first concern is how to store a model that may include many sophisticated objects. There are two immediate issues: How do we define a complex object How do we represent a collection of these objects. We can take a non hierarchical approach to modeling regarding these objects as symbols, and modeling our world as a collection of symbols CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics Symbols are usually represented at a convenient size and orientation. For example: a cylinder In OpenGL we have to set up the appropriate transformation from the frame of the symbol to the world coordinate frame to apply it to the model-view matrix before we execute the code for the symbol. CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics For example: the instance transformation M = TRS is a concatenation of a translation, a rotation, and a scale And the OpenGL program often contains this code: glMatrixMode(GL_MODELVIEW); glLaodIdentity(); glTranslatef(...); glRotatef(...); glScalef(...); glutSolidCylinder(...)’ CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics We can also think of such a model in the form of a table The table shows no relationship among the objects. However, it does contain everything we need to draw the objects. We could do a lot of things with this data structure, but its flatness limits us. CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 2. Hierarchical Models Suppose we wish to build an automobile that we can animate We can build it from the chassis, and 4 wheels CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics Two frames of our animation could look like this: We could calculate how far the wheel moved, and have code that looks like calculate(speed, distance); draw_right_front_wheel(speed, dist); draw_left_front_wheel(speed, dist); draw_right_rear_wheel(speed, dist); draw_left_rear_wheel(speed, dist); draw_chassis(speed, dist); CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics BUT this is the kind of code we do NOT want.... It is linear, and it shows none of the relationships between the 5 objects. There are two types of relationships we wish to convey First, we cannot separate the movement of the car from the movement of the wheels If the car moves forward, the wheels must turn. Second, we would like to note that all the wheels are identical and just located and oriented differently. We typically do this with a graph. Def: node, edge, root, leaf, ... CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics Tree Representation: DAG Representation: CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 3. A Robot Arm Robotics provides many opportunities for developing hierarchical models. Consider this arm It consists of 3 parts CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics The mechanism has 3 degrees of freedom, each of which can be described by a joint angle between the components In our model, each joint angle determines how to position a component with respect to the component to which it is attached q - rotation of the base f - rotation of first arm y - rotation of second arm piece. CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics We could write it as follows: display() { glRotatef(theta, 0.0, 1.0, 0.0); base(); glTranslatef(0.0, h1, 0.0); glRotatef(phi, 0.0, 0.0, 1.0); lower_arm(); glTranslatef(0.0, h2, 0.0); glRotatef(0.0, 0.0, 1.0); upper_arm(); } CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics Note that we have described the positioning of the arm independently of the details of the individual parts. We have also put it into a tree structure This makes it possible to write separate programs to describe the components and animate the robot. Drawing an object stored in a tree requires performing a tree traversal (you must visit every node) CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 4. Tree Traversal Here we have a box-like representation of a human figure. We can represent this figure as a tree CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics If we put the matrices with each node we can specify exactly how to draw the robot The issue is how to traverse the tree... Typically you do a pre-order traversal. This can be done in two ways: with code and a stack recursively (implicit stack) CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 4.1 A Stack-Based Traversal Consider the code necessary to draw the Robot. This function might be called from the display callback The Model-View matrix, M, in effect when the function is invoked determines the position of the robot relative to the rest of the scene. CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics The function must manipulate the model-view matrix before each part of the robot is drawn. In addition to the usual OpenGL functions for rotation, translation, and scaling, the functions glPushMatrix and glPopMatrix are particularly helpful for traversing our tree. The first glPushMatrix duplicates the current model-view matrix assuming that we have done a previous glMatrixMode(GL_MODELVIEW) When we have finished with changes we can do a glPopMatrix to get back the original one saved Note: we must do another glPushMatrix to leave a copy that we can later go back to. CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics OpenGL also has the functions glPushAttrig and glPopAttrib that allow us to deal with attributes in a similar manner OpenGL divides its state into groups, and allows a user to push any set of these groups on th attribute stack. The user needs only to set the bits in a mask that is the parameter for glPushAttrib Attribute groups include lighting, so we can push material properties and lights onto the stack. CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

5. Use of Tree Data Structures The second approach is to use a standard tree data structure to represent our hierarchy and then to render it with a traversal algorithm that is independent of the mode of traversal. CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics At each node we must store the information necessary to draw the object: a function that defines the object the homogeneous coordinate matrix that positions the object relative to the parent. Typedef struct treenode{ Glfloat m[16]; void (*f)(); struct treenode *sibling; struct treenode *child; } CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics Traversing the tree in a preorder traversal can be accomplished void traverse (treenode * root) { if(root == NULL) return glPushMatrix(); glMultMatrix(root->m); root->f(); if(root->child!= NULL) traverse(root->child); glPopMatrix(); if(root->sibling!= NULL) traverse(root->sibling); } CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 6. Animation Our robot example is articulated consists of rigid parts connected by joints We can make such models change their positions in time - animate them - by altering a small set of parameters. Hierarchical models allow us to reflect correctly the compound motions incorporating the physical relationships among parts of the model. CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics Of the many approaches to animation, a few basic techniques are of particular importance when we work with articulated figures. Kinematics describing the position of the parts of the model based on only their joint angles. Inverse kinematics and inverse dynamics given a desired state of the model, how can we adjust the angles so as to achieve this position? key-frame animation position the objects at a set of times. Inbetweening then fill in (interpolate). CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

5. Use of Tree Data Structures CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 6. Animation CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 7. Graphical Objects CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 7.1 Methods, Attributes, and Messages CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 7.2 A Cube Object CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 7.3 Objects and Hierarchy CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 7.4 Geometric Objects CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 8. Scene Graphs CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 9. Other Tree Structures CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 9.1 CSG Trees CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 9.2 BSP Trees CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 9.3 Quadtrees and Octrees CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 10. Graphics and the Web CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 10.1 Networks and Protocols CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 10.2 Hypermedia and HTML CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 10.3 Databases and VRML CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 10.4 JAVA and Applets CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 11. Summary CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics 12. Suggested Readings CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics

Chapter 8 -- Hierarchical and Object-Oriented Graphics

Exercises -- Due next class CS 480/680 Chapter 8 -- Hierarchical and Object-Oriented Graphics