Computer Graphics Matrix Hierarchies / Animation

Slides:



Advertisements
Similar presentations
This terms course Last term we both worked on learning 2 things –Processing –The concepts of graphics etc. This term will focus more on the basic concepts.
Advertisements

Recursion vs. Iteration The original Lisp language was truly a functional language: –Everything was expressed as functions –No local variables –No iteration.
Lecture 11 CSS314 Parallel Computing
3D Graphics for Game Programming (J. Han) Chapter XI Character Animation.
Advanced Programming for 3D Applications CE Bob Hobbs Staffordshire university Data Structures for Human Motion Lecture 5.
ME Robotics Dynamics of Robot Manipulators Purpose: This chapter introduces the dynamics of mechanisms. A robot can be treated as a set of linked.
Hierarchical Modeling I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Advanced Computer Graphics (Fall 2010) CS 283, Lecture 20: Inverse Kinematics Ravi Ramamoorthi Most slides courtesy.
Hierarchical Modeling II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Using Search in Problem Solving
General Trees and Variants CPSC 335. General Trees and transformation to binary trees B-tree variants: B*, B+, prefix B+ 2-4, Horizontal-vertical, Red-black.
Preorder Traversal with a Stack Push the root onto the stack. While the stack is not empty n pop the stack and visit it.
Week 4 Lecture 3: Character Animation Based on Interactive Computer Graphics (Angel) - Chapter 10 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley.
CSE 473 Dr. Charles B. Owen Fundamentals of 3D Game Development1 Skeletons and Skinning Bones and Skeletons Mesh Skinning.
Hierarchical Transformations and Models CSE 3541 Matt Boggus.
Hierarchical Transformations Hierarchical Models Scene Graphs
Binary Trees Chapter 6.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Velocities and Static Force
Advanced Graphics (and Animation) Spring 2002
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:
Data Structures Arrays both single and multiple dimensions Stacks Queues Trees Linked Lists.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Kinematic Linkages.
1 Trees Tree nomenclature Implementation strategies Traversals –Depth-first –Breadth-first Implementing binary search trees.
Geometric Transforms Changing coordinate systems.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
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.
1 CO Games Concepts Week 20 Matrices continued Gareth Bellaby.
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.
Computer Graphics Soft Body Animation - Skinning CO2409 Computer Graphics Week 22.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
1 Scene Graphs ©Anthony Steed Scene Graph Overview n Building Scene Structures n Traversal n Examples n Instancing and Re-Use n More Transformations.
SE 313 – Computer Graphics Lecture 6: Transformations Lecturer: Gazihan Alankuş Please look at the last three slides for assignments (marked with TODO)
Graphs. Made up of vertices and arcs Digraph (directed graph) –All arcs have arrows that give direction –You can only traverse the graph in the direction.
Kinematics Jehee Lee Seoul National University. Kinematics How to animate skeletons (articulated figures) Kinematics is the study of motion without regard.
Maths & Technologies for Games Animation: Practicalities CO3303 Week 3.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
Robot Kinematics: Position Analysis 2.1 INTRODUCTION  Forward Kinematics: to determine where the robot ’ s hand is? (If all joint variables are known)
Games Development Game Architecture: Entities CO2301 Games Development 1 Week 22.
Computer Graphics Rendering 2D Geometry CO2409 Computer Graphics Week 2.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Chapter 16 – Data Structures and Recursion. Data Structures u Built-in –Array –struct u User developed –linked list –stack –queue –tree Lesson 16.1.
Computer Graphics I, Fall 2008 Hierarchical Modeling II.
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.
Computer Graphics Matrices
2005MEE Software Engineering Lecture 7 –Stacks, Queues.
Advanced Games Development Game Physics CO2301 Games Development 1 Week 19.
1cs426-winter-2008 Notes. 2 Kinematics  The study of how things move  Usually boils down to describing the motion of articulated rigid figures Things.
Graphics for Games Particle Systems CO2301 Games Development 1 Week 23.
Computer Graphics I, Fall 2008 Hierarchical Modeling I.
Advanced Games Development Physics Engines 2 CO2301 Games Development 1 Week 21.
Object Animation CMT3317. Do you need to do animation? We consider ways of animating composite objects – that have a number of different parts e.g. a.
DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C++
Computer Graphics - Hierarchical Models-
Syntax-Directed Translation
Hierarchical and Object-Oriented Graphics
Skeletons and Skinning
Manipulator Dynamics 2 Instructor: Jacob Rosen
Chapter XIII Character Animation
Computer Animation Algorithms and Techniques
Hierarchical and Object-Oriented Graphics
Hierarchical Modeling & Constructive Solid Geometry
Richard Anderson Spring 2016
Dr. Chih-Kuo Yeh 葉智國 Computer Graphics Dr. Chih-Kuo Yeh 葉智國
Computer Graphics Matrix Hierarchies / Animation
Presentation transcript:

Computer Graphics Matrix Hierarchies / Animation CO2409 Computer Graphics Week 21

Lecture Contents Model Animation Model/Matrix Hierarchies Limitations of Hierarchies Rendering a Model Hierarchy Matrix Stacks Process

Model Animation So far we have looked at individual models: Each a fixed piece of geometry No moving parts We have animated these models in a way: By moving and rotating them each frame However, now we will focus on manipulating (animating) geometry that is: Made of several rigid parts (this lecture) Flexible with an underlying skeleton (next lecture)

Rigid Body Animation We start with models made up of several rigid parts that can move with respect to each other Mainly mechanical models, such as vehicles, doors, guns, robots… A common assumption for such models is that the parts form a hierarchy A tree structure defining how the parts are connected

Limitations of Hierarchies Most multi-part objects fit naturally into a hierarchical form In particular it’s usually easy to determine a root for the object But consider a bicycle chain – which link is the root? A hierarchical form also assumes that each part has only one parent that directly controls its movement Not true when multiple forces involved Train carriage with two engines Two people carrying a stretcher Need more complex solution for these cases Use a “solver” – part of a physics engine

Matrix Hierarchies In such a hierarchy: Each part has a parent, or is the root of the tree A part can have any number of children (including 0) Each part in the hierarchy has a world matrix Defining its position and orientation - just like a model However, the world matrix for each part is stored relative to its parent So each part is defined in the local space of its parent Root is stored in absolute world space Implies that child parts inherit their parent’s movement

Matrix Hierarchy: Diagram Such hierarchies are sometimes called Matrix Hierarchies or Transform Hierarchies

Building Hierarchies The position of a child’s origin determines where it will pivot relative to its parent The orientation of its axes will determines how it will rotate (in X, Y and Z) So the part’s matrix defines the joint with its parent Must ensure that we build the hierarchies and position matrices correctly To allow required animation Actually this is an issue for the 3D artist to resolve

Rendering Hierarchies We want to render a hierarchy of model parts We need absolute world matrices for each part rather that the parent-relative world matrix that is stored Can simply make the existing rendering code recursive – the code for each part is: Get absolute world matrix by combining this part’s relative matrix with the parent’s absolute world matrix Render part with absolute matrix Repeat process for each child part This process dictates a depth-first traversal of the hierarchy tree structure To pass matrices from parent to child easily (see lab)

Rendering Hierarchies: Matrix Stack Recursion may be inefficient for a real-world app that has many 100s or 1000s of models with many parts A human model may have 50 or 60 parts We can convert this recursive process to an iterative one To help us we use a Matrix Stack To store the matrices for ancestors of the current part DirectX provides such a feature Not difficult to write our own if necessary This is an efficient LIFO structure for pushing and popping matrices

Rendering Hierarchies Efficiently Put parts into a list in depth-first order Done in advance Also store depth in the hierarchy of each part Each part has its parent-relative matrix Call it the local matrix In the example will use M0, M1 etc.

Rendering Hierarchies Efficiently Iterating through the list is now the same as traversing the tree depth-first At each step, will keep track of: Absolute world matrix – call it W Current depth in hierarchy – call it CurrentDepth Initialise the process: Set W = the identity / unit matrix Set CurrentDepth = 0 Start with empty matrix stack

Rendering Hierarchies cont… For each part x in the hierarchy list: Get depth of part x, call it NewDepth If NewDepth > CurrentDepth, push W onto stack If NewDepth = CurrentDepth, do nothing to stack If NewDepth < CurrentDepth, pop matrices from stack Pop (CurrentDepth – NewDepth) times E.g. CurrentDepth = 3, NewDepth = 1, pop stack twice Set W = Matrix at top of stack * Mx Render part x using absolute world matrix W CurrentDepth = NewDepth

Rendering Hierarchies Example Starting with W = identity(I) & CurrentDepth = 0 0. NewDepth = 1 > CurrentDepth: push W (Stack:I) W = Stack Top * M0 = M0: render base with world matrix M0 1. NewDepth = 2 > current: push W (Stack: I, M0) W = Stack Top * M1 = M0.M1: render arm with matrix M0.M1 2. NewDepth = 3 > current: push W (Stack: I, M0, M0.M1) W = Stack Top * M2 = M0.M1.M2: render grip1 w. matrix M0.M1.M2 3. NewDepth = 3 = current: no change (Stack :I, M0, M0.M1) W = Stack Top * M3 = M0.M1.M3: render grip2 w. matrix M0.M1.M3 4. NewDepth = 2 < current: pop stack 1 time (Stack: I, M0) W = Stack Top * M4 = M0.M4: render switch with matrix M0.M4

Rendering Hierarchies Example Looking just at the render steps: Render base with world matrix M0 Render arm with matrix M0.M1 Render grip1 with matrix M0.M1.M2 Render grip2 with matrix M0.M1.M3 Render switch with matrix M0.M4 These are the correct combined matrices The process described is fairly simple to implement More efficient than recursive version