1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.

Slides:



Advertisements
Similar presentations
Hierarchical Modeling I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Advertisements

Hierarchical Modeling II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
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.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Objectives Review some advanced topics, including Review some advanced topics, including Chapter 8: Implementation Chapter 8: Implementation Chapter 9:
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Demetriou/Loizidou – ACSC330 – Chapter 9 Hierarchical and Object-Oriented Modeling Dr. Giorgos A. Demetriou Dr. Stephania Loizidou Himona Computer Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
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.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Kinematics Jehee Lee Seoul National University. Kinematics How to animate skeletons (articulated figures) Kinematics is the study of motion without regard.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Building Models Ed Angel Professor Emeritus of Computer Science University of New Mexico Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Transformations Tutorial
Jeff Parker, 2013 Thanks to Prof. Okan Arikan, UT Austin Ed Angel, UNM
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
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.
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.
Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Emeritus of Computer Science University of New Mexico.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Computer Graphics I, Fall 2008 Hierarchical Modeling I.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CSCE 441: Computer Graphics: Hierarchical Models Jinxiang Chai.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Hierarchical Models Chapter 9.
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Modeling and Hierarchy
Hierarchical Modeling II
Hierarchical Transformations Hierarchical Models Scene Graphs
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Computer Graphics - Hierarchical Models-
Modeling and Hierarchy
Hierarchical and Object-Oriented Graphics
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
CSCE 441: Computer Graphics: Hierarchical Models
Building Models Ed Angel Professor Emeritus of Computer Science
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Hierarchical and Object-Oriented Graphics
Hierarchical Modeling I
Hierarchical Modeling & Constructive Solid Geometry
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Dr. Chih-Kuo Yeh 葉智國 Computer Graphics Dr. Chih-Kuo Yeh 葉智國
Hierarchical Modeling
CSCE 441: Computer Graphics: Hierarchical Models
Presentation transcript:

1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

Hierarchical Modeling I Ed Angel Professor Emeritus of Computer Science, University of New Mexico 2 Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

3 Objectives Examine the limitations of linear modeling ­Symbols and instances Introduce hierarchical models ­Articulated models ­Robots Introduce Tree and DAG models Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

4 Instance Transformation Start with a prototype object (a symbol) Each appearance of the object in the model is an instance ­Must scale, orient, position ­Defines instance transformation Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

5 Symbol-Instance Table Can store a model by assigning a number to each symbol and storing the parameters for the instance transformation Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

6 Relationships in Car Model Symbol-instance table does not show relationships between parts of model Consider model of car ­Chassis + 4 identical wheels ­Two symbols Rate of forward motion determined by rotational speed of wheels Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

7 Structure Through Function Calls car(speed) { chassis() wheel(right_front); wheel(left_front); wheel(right_rear); wheel(left_rear); } Fails to show relationships well Look at problem using a graph Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

8 Graphs Set of nodes and edges (links) Edge connects a pair of nodes ­Directed or undirected Cycle: directed path that is a loop loop Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

9 Tree Graph in which each node (except the root) has exactly one parent node ­May have multiple children ­Leaf or terminal node: no children root node leaf node Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

10 Tree Model of Car Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

11 DAG Model If we use the fact that all the wheels are identical, we get a directed acyclic graph ­Not much different than dealing with a tree Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

12 Modeling with Trees Must decide what information to place in nodes and what to put in edges Nodes ­What to draw ­Pointers to children Edges ­May have information on incremental changes to transformation matrices (can also store in nodes) Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

13 Robot Arm robot arm parts in their own coodinate systems Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

14 Articulated Models Robot arm is an example of an articulated model ­Parts connected at joints ­Can specify state of model by giving all joint angles Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

15 Relationships in Robot Arm Base rotates independently ­Single angle determines position Lower arm attached to base ­Its position depends on rotation of base ­Must also translate relative to base and rotate about connecting joint Upper arm attached to lower arm ­Its position depends on both base and lower arm ­Must translate relative to lower arm and rotate about joint connecting to lower arm Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

16 Required Matrices Rotation of base: R b ­Apply M = R b to base Translate lower arm relative to base: T lu Rotate lower arm around joint: R lu ­Apply M = R b T lu R lu to lower arm Translate upper arm relative to upper arm: T uu Rotate upper arm around joint: R uu ­Apply M = R b T lu R lu T uu R uu to upper arm Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

17 WebGL Code for Robot var render = function() { gl.clear( gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT ); modelViewMatrix = rotate(theta[Base], 0, 1, 0 ); base(); modelViewMatrix = mult(modelViewMatrix, translate(0.0, BASE_HEIGHT, 0.0)); modelViewMatrix = mult(modelViewMatrix, rotate(theta[LowerArm], 0, 0, 1 )); lowerArm(); modelViewMatrix = mult(modelViewMatrix, translate(0.0, LOWER_ARM_HEIGHT, 0.0)); modelViewMatrix = mult(modelViewMatrix, rotate(theta[UpperArm], 0, 0, 1) ); upperArm(); requestAnimFra me(render); } Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

18 Tree Model of Robot Note code shows relationships between parts of model ­Can change “look” of parts easily without altering relationships Simple example of tree model Want a general node structure for nodes Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

19 Possible Node Structure Code for drawing part or pointer to drawing function linked list of pointers to children matrix relating node to parent Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015

20 Generalizations Need to deal with multiple children ­How do we represent a more general tree? ­How do we traverse such a data structure? Animation ­How to use dynamically? ­Can we create and delete nodes during execution? Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley 2015