Presentation is loading. Please wait.

Presentation is loading. Please wait.

VRML Scene Graphs. Learning Objectives Understand the concept of a scene graph Understand how VRML defines transformations (translations, rotations, and.

Similar presentations


Presentation on theme: "VRML Scene Graphs. Learning Objectives Understand the concept of a scene graph Understand how VRML defines transformations (translations, rotations, and."— Presentation transcript:

1 VRML Scene Graphs

2 Learning Objectives Understand the concept of a scene graph Understand how VRML defines transformations (translations, rotations, and scaling) Understand how to define children of transform nodes Understand how to create a VRML file with a scene graph using a text editor.

3 A Scene Graph Root T1T2T3 T4 Geom 1Geom 2 Geom 3Geom 4 Geom 5 Affected By T1 Affected By T2 Affected By (T4)*(T3)

4 What is a Transform? Transform { SFVec3f center 0 0 0 # (-, ) MFNode children [] SFRotation rotation 0 0 1 0 # [-1,1],(-, ) SFVec3f scale 1 1 1 # (0, ) SFRotation scaleOrientation 0 0 1 0 # [-1,1],(-, ) SFVec3f translation 0 0 0 # (-, ) SFVec3f bboxCenter 0 0 0 # (-, ) SFVec3f bboxSize -1 -1 -1 # (0, ) or -1,-1,-1 }

5 How Does The Transform Work? Given a 3-dimensional point P and Transform node, P is transformed into point P' in its parent's coordinate system by a series of intermediate transformations. In matrix transformation notation, where C (center), SR (scaleOrientation), T (translation), R (rotation), and S (scale) are the equivalent transformation matrices, P' = T × C × R × SR × S × -SR × -C × P (Note that this matrix notation is a transposed form of the material we studied earlier this semester)

6 In VRML, this would be Transform { translation T children Transform { translation C children Transform { rotation R children Transform { rotation SR children Transform { scale S children Transform { rotation -SR children Transform { translation -C children [...] }}}}}}}

7 What Do You Need To Remember? FIRST TRANSLATE THEN ROTATE

8 What About The Children? Anchor Background Billboard Collision ColorInterpolator CoordinateInterpolator CylinderSensor DirectionalLight Fog Group Inline LOD NavigationInfo NormalInterpolator OrientationInterpolator PlaneSensor PointLight PositionInterpolator ProximitySensor ScalarInterpolator Script Shape Sound SpotLight SphereSensor Switch TimeSensor TouchSensor Transform Viewpoint VisibilitySensor WorldInfo

9 How Do You Define Children? children [ Shape { geometry Sphere {} } Transform { translation 2 0 0 children DEF Joe Shape { geometry Sphere { radius.2 } } Transform { translation -2 0 0 children USE Joe } ] Sphr 1 Trans (2 0 0) Joe Trans (-2 0 0) Joe 2

10 Example 1 #VRML V2.0 utf8 Group { children [ Shape { geometry Sphere { radius 1 } } Transform { translation 5 0 0 children [ Shape { geometry Sphere { radius 2 } } Transform { translation -5 5 0 children [ Shape { geometry Sphere { radius 3 } } ]}]}]} Group Sph 1 Trans (5 0 0) Sph 2 Trans (-5 5 0) Sph 3.WRL file containing this example

11 Example 2 #VRML V2.0 utf8 Group { children [ Shape { geometry Sphere { radius 1 } } Transform { translation 5 0 0 children [ Shape { geometry Sphere { radius 2 } } ]} Transform { translation 0 5 0 children [ Shape { geometry Sphere { radius 3 } } ]}]} Group Sph 1 Trans (5 0 0) Sph 2 Trans (0 5 0) Sph 3.WRL file containing this example

12 Let’s Make This x y y z 10 2 2 3 3 3 5

13 Learning Objectives Understand the concept of a scene graph Understand how VRML defines transformations (translations, rotations, and scaling) Understand how to define children of transform nodes Understand how to create a VRML file with a scene graph using a text editor.

14


Download ppt "VRML Scene Graphs. Learning Objectives Understand the concept of a scene graph Understand how VRML defines transformations (translations, rotations, and."

Similar presentations


Ads by Google