1 / 14

# VRML Scene Graphs

VRML Scene Graphs. 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.

Télécharger la présentation

## VRML Scene Graphs

E N D

### 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 T1 T2 T3 T4 Geom 3 Geom 4 Geom 1 Geom 2 Geom 5 Affected By T2 Affected By T1 Affected By (T4)*(T3) Affected By T2

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. Anchor Background Billboard Collision ColorInterpolator CoordinateInterpolator CylinderSensor DirectionalLight Fog Group Inline LOD NavigationInfo NormalInterpolator OrientationInterpolator PlaneSensor PointLight PositionInterpolator ProximitySensor ScalarInterpolator Script Shape What About The Children? • 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) Trans (2 0 0) Joe 2 Joe

10. Example 1 Group #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 } } ]}]}]} Sph 1 Trans (5 0 0) Sph 2 Trans (-5 5 0) Sph 3 .WRL file containing this example

11. Example 2 Group #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 } } ]}]} Sph 1 Trans (0 5 0) Trans (5 0 0) Sph 3 Sph 2 .WRL file containing this example

12. Let’s Make This y y 3 3 10 2 2 z x 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.

More Related