Hierarchical Transformations Hierarchical Models Scene Graphs

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

Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutWireCube glutWireCone gluCylinder glutWireTeapot.
1Notes  Assignment 0 marks should be ready by tonight (hand back in class on Monday)
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
Hierarchical Modeling I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
Hierarchical Modeling II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
CSC 123 – Animating characters Hierarchical modeling Zoë Wood.
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
CSE 331 Software Design & Implementation Hal Perkins Winter 2013 Design Patterns Part 3 (Slides by Mike Ernst and David Notkin) 1.
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
Introduction to 3D Graphics Lecture 4: Scenes and Scene Graphs Anthony Steed University College London.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
Objectives Review some advanced topics, including Review some advanced topics, including Chapter 8: Implementation Chapter 8: Implementation Chapter 9:
C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 1/29 Geometric Transformations Readings: Chapters 5-6.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Kinematic Linkages.
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,
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.
1 Scene Graphs ©Anthony Steed Scene Graph Overview n Building Scene Structures n Traversal n Examples n Instancing and Re-Use n More Transformations.
Kinematics Jehee Lee Seoul National University. Kinematics How to animate skeletons (articulated figures) Kinematics is the study of motion without regard.
1 Scene Graphs Week 4.2 ©Anthony Steed
Jul 25, 2014IAT 3551 Scene Graphs.  A data structure that stores information about a graphics scene –Each node has information that structures the interpretation.
CS324e - Elements of Graphics and Visualization Java 3D Intro.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 2 – Basic VRML.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Transformations Tutorial
1/50 CS148: Introduction to Computer Graphics and Imaging Transforms CS148: Introduction to Computer Graphics and Imaging Transforms.
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.
Lecture 7 Midterm Review. OpenGL Libraries gl: Basic OpenGL library, e.g. primitives. glu: OpenGL Utility library, a set of functions to create texture.
CS559: Computer Graphics Lecture 13: Hierarchical Modeling and Curves Li Zhang Spring 2010.
Computer Graphics I, Fall 2008 Hierarchical Modeling I.
CSCE 441: Computer Graphics: Hierarchical Models Jinxiang Chai.
3D Ojbects: Transformations and Modeling. Matrix Operations Matrices have dimensions: Vectors can be thought of as matrices: v=[2,3,4,1] is a 1x4 matrix.
Institute for Computer Graphics and Vision Computer Graphics and Interactive Systems 1 Grabner HS i4, 2006/03/08 Web3D, VRVU, SGP Web3D ( ) VRVU.
Hierarchical Models Chapter 9.
- Introduction - Graphics Pipeline
IAT 355 Scene Graphs Feb 23, 2017 IAT 355.
Data Structures Binary Trees 1.
Graphical Objects and Scene Graphs
Csc 2720 Instructor: Zhuojun Duan
Modeling and Hierarchy
Hierarchical Modeling II
Computer Graphics - Hierarchical Models-
Transformations.
Modeling and Hierarchy
Hierarchical and Object-Oriented Graphics
Introduction to Computer Graphics with WebGL
CSCE 441: Computer Graphics: Hierarchical Models
Projection in 3-D Glenn G. Chappell
Hierarchical and Object-Oriented Graphics
Hierarchical Modeling I
Hierarchical Modeling & Constructive Solid Geometry
Important Problem Types and Fundamental Data Structures
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 Transformations Hierarchical Models Scene Graphs Modeling Hierarchical Transformations Hierarchical Models Scene Graphs

Modeling Objects A prototype has a default size, position, and orientation You need to perform modeling transformations to position it within the scene myCube() - Create a unit cube with its origin at (0,0,0) To create a 2 x 0.1 x 2 table top - need to call glScalef(2, 0.1, 2)

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

Symbol-Instance Table Can store a model by assigning a number to each symbol and storing the parameters for the instance transformation

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

Structure Through Function Calls car(speed) { chassis(speed) wheel(right_front, speed); wheel(left_front , speed); wheel(right_rear , speed); wheel(left_rear , speed); } Fails to show relationships well Look at problem using a graph

Graphs Set of nodes and edges (links) Edge connects a pair of nodes Directed or undirected Cycle: directed path that is a loop loop

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

Tree Model of Car

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

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)

Robot Arm parts in their own coordinate systems robot arm

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

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

Relationships in Robot Arm 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

Required Matrices Rotation of base: Rb Apply M = Rb to base Translate lower arm relative to base: Tla Rotate lower arm around joint: Rla Apply M = Rb Tla Rla to lower arm Translate upper arm relative to upper arm: Tua Rotate upper arm around joint: Rua Apply M = Rb Tla Rla Tua Rua to upper arm

OpenGL Code for Robot robot_arm() { glRotate(theta, 0.0, 1.0, 0.0); base(); glTranslate(0.0, h1, 0.0); glRotate(phi, 0.0, 1.0, 0.0); lower_arm(); glTranslate(0.0, h2, 0.0); glRotate(psi, 0.0, 1.0, 0.0); upper_arm(); }

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

Scene Graphs Encoding this information in the code is not very productive. Want it to be flexible, data-driven and extensible. Scene-graphs provide this functionality. OpenInventor (http://www.coin3d.org/) Open Scene Graph (http://www.openscenegraph.com/) Many others

Hierarchical Modeling Triangles, parametric curves and surfaces are the building blocks from which more complex real-world objects are modeled. Hierarchical modeling creates complex real-world objects by combining simple primitive shapes into more complex aggregate objects.

Articulated Models

Multiple Components Different Materials

Scene Layout – Worlds

Hierarchical models

Hierarchical models

Hierarchical models

Hierarchical models

Hierarchical models

Hierarchical Grouping of Objects Logical organization of scene fruits chair table ground

Simple Example with Groups numObjects 3 Box { <BOX PARAMS> } Box { <BOX PARAMS> } } numObjects 2 Sphere { <SPHERE PARAMS> } Sphere { <SPHERE PARAMS> } } } Plane { <PLANE PARAMS> } }

Adding Materials Group { numObjects 3 Material { <BLUE> } Box { <BOX PARAMS> } Box { <BOX PARAMS> } } numObjects 2 Material { <BROWN> } Material { <GREEN> } Material { <RED> } Sphere { <SPHERE PARAMS> } Material { <ORANGE> } Sphere { <SPHERE PARAMS> } } } Material { <BLACK> } Plane { <PLANE PARAMS> } }

Adding Transformations

Hierarchical Transformation of Objects Transforms position logical groupings of objects within the scene

Simple Example with Transforms Group { numObjects 3 Transform { ZRotate { 45 } Box { <BOX PARAMS> } Box { <BOX PARAMS> } } } Translate { -2 0 0 } numObjects 2 Box { <BOX PARAMS> } } Sphere { <SPHERE PARAMS> } Sphere { <SPHERE PARAMS> } } } } Plane { <PLANE PARAMS> } }

Separating types of transformation Note that we have treated translations, rotations, etc. as separate But they are all represented by 4x4 matrices and there is no technical reason not to combine them into the resulting matrix It’s just simpler for the human programmer, and corresponds to the handle of 3D modeling/animation packages

Hierarchical modeling Commands to change current transformation Translate, Scale, etc. Affects the state, i.e. all following commands will undergo this transformation Utilities to maintain a matrix stack (to revert to previous state)

Model vs. Projection matrix It is almost the same to rotate the camera or the objects Main difference: Lighting Example: Examiner viewer Is the camera moving or is the object. Trackball implementation will be a future lab.

Managing the state To reset everything: LoadIdentity(); Keep a stack of matrices PushMatrix() PopMatrix()

Managing the state Push matrix when you start visiting a group Pop once you are done

Scene Graph Convenient Data structure for scene representation Transformations Materials, color Multiple instances Basic idea: Hierarchical Tree Useful for manipulation/animation Especially for articulated figures Useful for rendering too Multi-pass rendering, occlusion culling

Scene Graphs Basic idea: Tree Comprised of several node types: Shape: 3D geometric objects Transform: Affect current transformation Property: Appearance, texture, etc. Group: Collection of subgraphs

Traversal Depth first Top to bottom, left to right

Traversal State The State is updated during traversal Transformations, properties Influence of nodes can be complex E.g. bottom to top

Other Scene Nodes Switch or Selector Nodes Sequence Nodes Level of detail Different rendering styles Damaged v. undamaged states Sequence Nodes Animated sequence Objects Textures Transformations

Graphs vs. Scene Managers Typically we limit the use of a scenegraph to individual models. Use a space partitioning scheme for large scenes. Each cell or partition contains a scenegraph (or set of scenegraphs).

Object Following or Tethering Can attach an object to the node of another object (or group them in a parent node. Provide an offset to have the other object tag along with the object under control.

Camera Tethering Many times, we want the camera to follow an entity. Need to get the coordinate frame for the entity. Traverse the scene graph to the entity. Or, need to get the current camera system Attach camera and determine transformations to the root of the scene graph.

Visitor pattern Visitor encodes a traversal of a hierarchical data structure Nodes – objects in the hierarchy – accept visitors; visitors visit nodes n.accept(v) performs a depth-first traversal of the structure rooted at n, performing v's operation on each element of the structure class Node { void accept(Visitor v) { for each child of node { child.accept(v); } v.visit(this); class Visitor { void visit(Node n) { // perform work on n

Sequence of calls to accept and visit a.accept(v) b.accept(v) d.accept(v) v.visit(d) e.accept(v) v.visit(e) v.visit(b) c.accept(v) f.accept(v) v.visit(f) v.visit(c) v.visit(a) Sequence of calls to visit: <d, e, b, f, c, a>

Implementing visitor You must add definitions of visit and accept visit might count nodes, perform typechecking, etc. It is easy to add operations (visitors), hard to add nodes (modify each existing visitor) Visitors are similar to iterators: each element of the data structure is presented in turn to the visit method Visitors have knowledge of the structure, not just the sequence

Also known as double dispatch See Asteroids example on: https://en.wikipedia.org/wiki/Double_dispatch