1 Scene Graphs Week 4.2 ©Anthony Steed
2 Scene Graph Overview n Building Scene Structures n Traversal n Examples n Instancing and Re-Use n More Transformations
3 Concept of Scene Graph n Objects placed relative to one another n Objects made of similar components n Directed acyclic graph root
4 Use for Animation/Modelling
5 n One object has a local transformation relative to its parent shoulder is translation (0 1 0) from base upper arm is translation (0 3 0) from shoulder elbow is translation (0 3 0) from upper arm fore arm is rotation Z by 90 then translation (0 2 0)
6 Rendering Traverse n Must get object definitions in WC before passing to camera n For object under Base p.B is in WC n “inherit” matrices down stack n So for object under shoulder p.SB is in WC (p.S is in base coordinates)
7 In general n On traverse “push” on graph descend “pop” on graph ascend n Combined matrix is current transform (CTM)
8 Sharing Nodes n E.G. One table many places n Table1 has CTM T1T0 n Table1 has CTM T2T0 table table2 table1 T1 T2 T0
9 Spherical Coordinates n Represent a point on a using two angles and . Where r = length(x,y,z) Z P(x,y,z) X Y Q O Q is projection of P onto XY plane is angle between X axis and OQ is angle between OP and Z axis
10 Spherical Coordinates n Length OQ = r sin( ) n So x = r sin( )cos( ) y = r sin( )sin( ) z = r cos( )
11 Rotation About an Arbitrary Axis Z X Y O p1 p2
12 … 1. Translate p1 so it is at the origin 2. Let p3 = p2-p1 (new position of p2) find spherical co-ordinate of p3 (r, , ) 3. Rotate about Z by - to bring p3 into ZX plane 4. Rotate about Y by - to bring p3 onto Z axis 5. Now rotate about Z by 6. Invert steps 4-1
13 … Z Y O p1 p2 Z Y O p3 StartTranslate
14 … Z Y p3 Rotate1 Z Y p3 Rotate2
15 … Z Y p3 After Steps 1-4 n Now we apply the transformation we are after n Invert steps 4-1
16 Scene Graph Recap n Use of scene graph to model environments n Notion of render traversal and the current transformation matrix n Instancing and sharing of nodes n Rotation of objects around an arbitrary axis