VRML Scene Graphs. Learning Objectives Understand the concept of a scene graph Understand how VRML...

14
VRML Scene Graphs

Transcript of VRML Scene Graphs. Learning Objectives Understand the concept of a scene graph Understand how VRML...

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

VRML Scene Graphs

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

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.

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

A Scene GraphRoot

T1 T2 T3

T4

Geom 1 Geom 2 Geom 3 Geom 4

Geom 5Affected By T1

Affected By T2

Affected By T2

Affected By (T4)*(T3)

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

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

}

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

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)

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

In VRML, this would beTransform {

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 [...]

}}}}}}}

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

What Do You Need To Remember?

•FIRST TRANSLATE

•THEN ROTATE

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

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

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

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

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

Example 1#VRML V2.0 utf8Group { 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 2Trans

(-5 5 0)

Sph 3

.WRL file containing this example

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

Example 2#VRML V2.0 utf8Group { 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

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

Let’s Make This

x

yy

z

10

2

2

3

3

3 5

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

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.

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