Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Chapter 11: Hierarchical Modeling.

Slides:



Advertisements
Similar presentations
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Advertisements

2D Geometric Transformations
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.
Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutWireCube glutWireCone gluCylinder glutWireTeapot.
Chapter 4.2 Collision Detection and Resolution. 2 Collision Detection Complicated for two reasons 1. Geometry is typically very complex, potentially requiring.
1 Computer Graphics Week6 –Basic Transformations- Translation & Scaling.
Bounding Volume Hierarchy “Efficient Distance Computation Between Non-Convex Objects” Sean Quinlan Stanford, 1994 Presented by Mathieu Brédif.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Better Interactive Programs Ed Angel Professor of Computer Science, Electrical and Computer.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 14 Chapter 14: The Camera.
Chapter 10: Coordinate Systems Chapter 10.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Goals Give student some idea.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 12 Chapter 12: Making the Applications Interesting.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 7 Chapter 7: Graphical Primitives.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 3 Chapter 3: Simple Graphics Program.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 4 Chapter 4: Working with Graphics APIs.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 8 Chapter 8: Transformation Operators.
Collision Detection David Johnson Cs6360 – Virtual Reality.
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
CAP4730: Computational Structures in Computer Graphics
2D Transformations. World Coordinates Translate Rotate Scale Viewport Transforms Hierarchical Model Transforms Putting it all together.
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
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.
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.
CSC461 Lecture 11: Interactive Programs Contents and Objectives Picking Writing modes – XOR/Copy Rubberbanding Display list.
CSE 381 – Advanced Game Programming Quickhull and GJK.
Triangulation Introduction to Computer Graphics and Animation (Principle of Computer Graphics) Rattapoom Waranusast.
1 Scene Graphs ©Anthony Steed Scene Graph Overview n Building Scene Structures n Traversal n Examples n Instancing and Re-Use n More Transformations.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 5 Chapter 5: MVC Architecture.
Kinematics Jehee Lee Seoul National University. Kinematics How to animate skeletons (articulated figures) Kinematics is the study of motion without regard.
2008/9/24 Kim, HyungSeok. HyungSeok Kim, Konkuk University Part I: Framework – 1. Windows creation – 2. Renderer – 3. Lights and Objects/Model loading.
1 Scene Graphs Week 4.2 ©Anthony Steed
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 15 Chapter 15: Working with the Camera.
Transformations Objective: to develop an understanding of the four transformations. Starter – if 24 x 72 = 2016, find the value of: 1)2.8 x 72 = 2)2.8.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 2 – Basic VRML.
1/50 CS148: Introduction to Computer Graphics and Imaging Transforms CS148: Introduction to Computer Graphics and Imaging Transforms.
In the name of God Computer Graphics.
Computer Graphics Matrix Hierarchies / Animation
University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Hierarchical Modeling.
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 9 Chapter 9: Combining Transformation Operators.
Computer Graphics I, Fall 2010 Transformations.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 6 Examples 1,
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
CSCE 441: Computer Graphics: Hierarchical Models Jinxiang Chai.
Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 5 Examples 1.
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.
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.
In the name of God Computer Graphics.
Ogre Overview Lecture 3.
Chapter 3 Drawing In the World.
CSCE 441: Computer Graphics: Hierarchical Models
Hierarchical Modeling
Better Interactive Programs
Hierarchical Modeling & Constructive Solid Geometry
Geometric Objects and Transformations (II)
Collision Detection.
Dr. Chih-Kuo Yeh 葉智國 Computer Graphics Dr. Chih-Kuo Yeh 葉智國
Hierarchical Modeling
3.3: Rectangle Collisions
CSCE 441: Computer Graphics: Hierarchical Models
GPAT – Chapter 7 Physics.
Presentation transcript:

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Chapter 11: Hierarchical Modeling

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 This Chapter: we will learn about Building Hierarchical Models Controlling components in a Hierarchical Model Object Coordinate System Scene Graphs/Trees/Nodes

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 We wish to draw a vertex V i What is being drawn is V o, where For D3D We have see: M V = M w2n This chapter, we examine what to do with M W M P = I 4 will not change until 3D Review of D3D …

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Motivation … A circle at V i = ( x i, y i ) with radius r Define a triangle fan Either: centered at V i with radius r Or: at origin (0,0), with radius 1.0 AND Load: M W = S(r,, r) T(x i,, y i ) XformInfo class: to compute/load M W = T(-p x, -p y )S(s y, s y )R(θ)T(p x,, p y )T(t x,, t y ) A general operator to transform primitives

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Now, a simple Arm … Rectangle: Circle: Want to: Rotate the entire Arm about Pivot: EASY to accomplish with xformInfo!

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.1: Controlling Simple Arm Controls

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.1: some details … Label C: Sets top of Stack to Identity: I 4 Label D: On the stack computes M a = T(-p x, -p y )S(s y, s y )R(θ)T(p x,, p y )T(t x,, t y ) AND Loads top of stack to: WORLD matrix ( M W = M a )

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.1: more detilas M W = M a where … M a = T(-p x, -p y )S(s y, s y )R(θ)T(p x,, p y )T(t x,, t y ) Arm movement is accomplished … With no changes to any of the vertices R a0 and C p0 vertices are not altered! With xformInfo class Load M a from top of stack to M W Then draw

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Generalize the idea … Control the Palm on the arm Palm is the circle ( C p0 ) pivoted at ( P p ) Observe (intuition) Palm follows the arm xform i.e., when rotate arm, palm must follow Palm has additional xform … i.e., palm can be rotated independent from arm

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.2: Parent/Child Xform Note: Label A: one more XformInfo object

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.2: Some details … Label B: Computes M a from m_ArmXform Draws R a0 rectangle with M W = M a Label C: Computes M p from m_PalmXform and concatenates with M a to compute: M p M a Draws C p0 rectangle with M W = M p M a

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Observations: Graphical Objects Geometric Primitives Once defined, do not alter Interactive control Accomplished via computing/setting transformations Components By strategically defining/concatenating separate transforms Accomplish intuitive group/component control

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Lib 11: SceneNode class Design to support convenient concatenation of XformInfo

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 SceneNode Details

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.3: SceneNode Look/Feel: identical to Tut 11.2

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.4: Subclass from SceneNode Look/Feel: identical to Tut 11.2/11.3

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.5: SceneTreeControl (GUI support) SceneTreeControl

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 SceneTreeControl: some details

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 SceneTreeControl: Implementation

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.6: Hierarchy of SceneNodes

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.6: Implementation

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 12.6: Details … Body xformed by: Left Arm by: Left Palm by:

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Instancing: sharing … Notice … left and right arm/palm are identical! How can we re-use?!

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Instancing: Sharing of hierarchy Arm hierarchy shared by separate left/right transforms See: two separate arms: left Arm palm Right Arm palm

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Sharing Hierarchy: Problem Transforms: Left Arm/Palm Right Arm/Palm Notice: M a and M p in both left and right When change these two transforms Left/right arm/palm will change in identical manner! In this case: no way to control left/right separately!

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Instancing: Sharing Geometry Problem: complexity!

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Instancing: Discussion … Commercial System: Sharing of geometry Memory management is tricky! reference count Sharing of hierarchy Typically not used because of restricted control UWBGL_LIB: DO NOT support any form of instancing

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Object Coordinate (OC) System

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Left Arm/Palm to WC Transform

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Object Coordinate and Transforms Drawing: XformInfo in SceneNode Computes/loads M W to transform node OC to WC WindowHandler ( DrawOnlyHandler::DrawGraphics() ): Computes load M w2n to M V to transform form WC to NDC Mouse click selection Positions are given to us in HC space! Our program represent graphical objects in OC! Collision: we must decide! Perform computation in WC? Or Perform computation in OC?

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Mouse Click Selection Two Tasks: Coordinate Space: From DC to OC Proximity Test: when in OC determine if mouse click is close to object

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Mouse click position in OCs

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 DC to OC Transforms … Mouse click: In Body OC: In Left Arm OC: In Left Palm OC:

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Proximity Test: Close-enough test In general: expensive! In our case: Use point in bounding volume

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Lib12: SceneNode bound support Bound: in WC Velocity: for moving the entire node (by changing XformInfo)

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Lib12: Transformation support DrawHelper:: TransformPoint() Transforms a point based Using the top of matrix stack Usage: Push matrix stack Compute transform on the matrix stack Transform points Pop matrix stack

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Compute SceneNode BBox

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 SceneNode: Bound implementation A: BBox of all primitives for this node B: OC to WC matrix C: Transform BBOX to WC D: Compute/Merge with Children BBOX

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 SceneNode:: GetNodeBound() A: If specific scene node found: compute bound starting from this node B: if not found, Set OC to WC xform and B1: continue traversing down the hierarchy (looking for given node) C: Restore Xfrom Stack

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.7: Mouse Hit Detection LMB click in bound to see component selected

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut: 11.7: some details

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.8: Collision CPrimitiveArm: is a primitive Can be used as bullets In the CModel m_bullets array

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.8: UpdateSimulation() B: Keeps references to colliding parts (Palms) C: Collide all bullets (balls and PrimitiveArm) With Left/Right Palms D: Randomly create new bullets

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.8: Lesson … Rough Approximation: Proximity tests are simple Bbox Many false positives! Multiple collisions: A bullet can intersect with a palm multiple times! Resulting in multiple hitCount for the same palm/bullet collisions

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 11 Tut 11.9: Simple Animation … Continuously change the xform of a SceneNode (palm)