VRML Scene Graphs. Learning Objectives Understand the concept of a scene graph Understand how VRML...
-
Upload
daniel-hutchinson -
Category
Documents
-
view
214 -
download
1
Transcript of VRML Scene Graphs. Learning Objectives Understand the concept of a scene graph Understand how VRML...
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.
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)
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
}
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)
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 [...]
}}}}}}}
What Do You Need To Remember?
•FIRST TRANSLATE
•THEN ROTATE
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
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
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
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
Let’s Make This
x
yy
z
10
2
2
3
3
3 5
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.