VRML - 1 Virtual Reality Modeling Language (VRML) Peter O’Grady.
111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.
-
Upload
garry-wilson -
Category
Documents
-
view
212 -
download
0
Transcript of 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.
![Page 1: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/1.jpg)
104/20/23 19:16
UML
VRML 2.0 Scene Graph Structure
Group
Transformation
Shape
Nodes
![Page 2: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/2.jpg)
204/20/23 19:16
UML
Shape Node:Contained Nodes
Shape
BoxConeCylinderSphereExtrusion
Text PointSet
IndexedLineSet
IndexedFaceSet
ElevationGrid
FontStyle Coordinate Color Normal TextureCoordinate
geometry
Material Image, MoviePixelTexture
TextureTransform
Appearance
appearance
color
color
colorco
ord coo
rd coord
color
fontStyle
normal
normal
texCoord
texCoord
material
texture
textureTransform
![Page 3: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/3.jpg)
304/20/23 19:16
UML
Text Node DefinitionfontStyle Node Definition Text {
exposedField MFString string []exposedField SFNode fontStyle NULLexposedField MFFloat length []exposedField SFFloat maxExtent 0.0
}
FontStyle {field MFString family “SERIF” field SFBool horizontal TRUEfield MFString justify “BEGIN”field SFSring language ““field SFFloat size 1.0field SFFloat spacing 1.0field SFString style “PLAIN”field SFBool topToBottom TRUEfield SFBool leftToRight TRUE
}
![Page 4: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/4.jpg)
404/20/23 19:16
UML
Appearance & Material Nodes
Appearance {exposedField SFNode material NULLexposedField SFNode texture NULLexposedField SFNode textureTransform NULL
}
Material {exposedField SFFloat ambientIntensity 0.2exposedField SFColor diffuseColor 0.8 0.8 0.8exposedField SFColor emissiveColor 0 0 0 exposedField SFFloat shininess 0.2exposedField SFColor specularColor 0 0 0exposedField SFFloat transparency 0
}
![Page 5: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/5.jpg)
504/20/23 19:16
UML
Texture Node Definitions
ImageTexture {exposedField MFString url []field SFBool repeatS TRUEfeild SFBool repeatT TRUE
}
PixelTexture {exposedField SFImage image 0 0 0field SFBool repeatS TRUEfeild SFBool repeatT TRUE
}
![Page 6: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/6.jpg)
604/20/23 19:16
UML
Texture Node Definitions,Continued
MovieTexture {exposedField SFBool loop FALSEexposedField SFFloat speed 1exposedField SFTime startTime 0exposedField SFTime stopTime 0exposedField MFString url []field SFBool repeatS TRUEfield SFBool repeatT TRUEeventOut SFFloat duration_changedeventOut SFBool isActive
}
![Page 7: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/7.jpg)
704/20/23 19:16
UML
Lighting in VRML 2.0Directional Light Source
DirectionalLight {exposedField SFFloat ambientIntensity 0exposedField SFColor color 1 1 1exposedField SFVec3f direction 0 0 -1exposedField SFFloat intensity 1exposedField SFBool on TRUE
}
Directional lights are “scoped” to illuminate only objects intheir group.
![Page 8: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/8.jpg)
804/20/23 19:16
UML
Lighting in VRML 2.0Point Light Sources
PointLight {exposedField SFFloat ambientIntensity 0exposedField SFVec3f attenuation 1 0 0exposedField SFColor color 1 1 1exposedField SFFloat intensity 1exposedField SFVec3f location 0 0 0exposedField SFBool on TRUEexposedField SFFloat radius 100
}
Scoping for the PointLight is given by the radius field,beyond which no objects are illuminated
![Page 9: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/9.jpg)
904/20/23 19:16
UML
Lighting in VRML 2.0Spotlights
SpotLight {exposedField SFFloat ambientIntensity 0exposedField SFVec3f attenuation 1 0 0exposedField SFFloat beamwidth 1.570796exposedField SFColor color 1 1 1exposedField SFFloat cutOffAngle 0.785398exposedField SFVec3f direction 0 0 -1exposedField SFFloat intensity 1exposedField SFVec3f location 0 0 0exposedField SFBool on TRUEexposedField SFFloat radius 100
}
![Page 10: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/10.jpg)
1004/20/23 19:16
UML
Transform Node Definition
Transform {enventIn MFNode addChildreneventIn MFNode removeChildren exposedField SFVec3f center 0 0 0exposedField MFNode children []exposedField SFRotation rotation 0 0 1 0exposedField SFVec3f scale 1 1 1exposedField SFRotation scaleOrientation 0 0 1 0exposedField SFVec3f translation 0 0 0field SFVec3f bboxCenter 0 0 0field SFVec3f bboxSize -1 -1 -1
}
Order of application:
T(translation) • T(rotation) • T(scale) {children}
![Page 11: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/11.jpg)
1104/20/23 19:16
UML
GroupNode Definition
Transform {enventIn MFNode addChildreneventIn MFNode removeChildren exposedField MFNode children []field SFVec3f bboxCenter 0 0 0field SFVec3f bboxSize -1 -1 -1
}
![Page 12: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/12.jpg)
1204/20/23 19:16
UML
Viewing in VRML 2.0
Viewpoint {eventIn SFBool set_bindexposedField SFFloat fieldOfView 0.785396exposedField SFBool jump TRUEexposedField SFRotation orientation 0 0 1 0exposedField SFVec3f position 0 0 10field SFString description ““eventOut SFTime bindTimeeventOut SFBool isBound
}
![Page 13: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/13.jpg)
1304/20/23 19:16
UML
Sound in VRML 2.0Definition of Sound Node
Sound {exposedField SFVec3f direction 0 0 1exposedField SFFloat intensity 1exposedField SFVec3f location 0 0 0exposedField SFFloat maxBack 10exposedField SFFloat maxFront 10exposedField SFFloat minBack 1exposedField SFFloat minFront 1exposedField SFFloat priority 0exposedField SFNode source NULLfield SFBool spatialize TRUE
}
![Page 14: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/14.jpg)
1404/20/23 19:16
UML
Sound in VRML2.0Definition of AudioClip Node
AudioClip {exposedField SFString description ““exposedField SFBool loop FALSEexposedField SFFloat pitch 1.0exposedField SFTime startTime 0exposedField SFTime stopTime 0exposedField MFString url []eventOut duration_changedeventOut isActive
}
![Page 15: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/15.jpg)
1504/20/23 19:16
UML
Spatial Sound Pattern in VRML 2.0
location
minBack
maxBack
minFront
maxFront
Constant intensity
Linear Attenuation
direction
![Page 16: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/16.jpg)
1604/20/23 19:16
UML
Internode Communication:Events
Node A Node B
Node C
eventOut
eventIn
Connection by a ROUTE
![Page 17: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/17.jpg)
1704/20/23 19:16
UML
Internode CommunicationNode Field Classes
field Private node member
exposedField Public node member
eventIn Event received by node
eventOut Event sent by node
set_<fieldNname> Event received by node<fieldName>_changed Event sent by node
Type and value of events correspond to type and value of node fields.
![Page 18: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/18.jpg)
1804/20/23 19:16
UML
Internode CommunicationRoute Syntax
DEF T1 Transform { . . . }DEF T2 Transform { . . . }DEF T3 Transform { . . . }. . .ROUTE T1.translation_changed TO T2.set_translationROUTE T2.translation_changed TO T3.set_translation
T1 T2 T3
translation translation translation
![Page 19: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/19.jpg)
1904/20/23 19:16
UML
Event Generators:Touch Sensor
= Shapes Sensed
![Page 20: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/20.jpg)
2004/20/23 19:16
UML
Event Generators:Touch Sensor
TouchSensor {exposedField SFBool enabled TRUEeventOut SFVec3f hitNormal_changedeventOut SFVec3f hitPoint_changedeventOut SFVec2f hitTexCoord_changedeventOut SFBool isActiveeventOut SFBool isOvereventOut SFTime touchTime
}
![Page 21: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/21.jpg)
2104/20/23 19:16
UML
Touch SensorExample
Group {children [
DEF TS TouchSensor { }Shape {
appearance Appearance {material Material {
diffuseColor 0 0.5 0}
}geometry Sphere {}
}DEF Highlight DirectionalLight {
color 1 0 0on FALSE
}DEF ActiveLight DirectionalLight {
color 0 0 1on FALSE
}]ROUTE TS.isOver TO Highlight.set_onROUTE TS.isActive TO ActiveLight.set_on
}
![Page 22: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/22.jpg)
2204/20/23 19:16
UML
Touch SensorExample
Group {children [
DEF TS TouchSensor { }Shape {
appearance Appearance {material Material {
diffuseColor 0 0.5 0}
}geometry Sphere {}
}Sound {
maxBack 1000maxFront 1000source DEF Audio AudioClip {
url “horse.wav”}
}]ROUTE TS.touchTime TO Audio.startTime
}
![Page 23: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/23.jpg)
2304/20/23 19:16
UML
Adding Behavior to Objects
TimeSensor Interpolator General Node
[0,1]
ScalarInterpolatorPositionInterpolatorOrientationInterpolatorCoordinateInterpolatorColorInterpolator
Maps [0,1]to fielddata typevalues.
Generatestime vary-ing scalarin range[0,1]
![Page 24: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/24.jpg)
2404/20/23 19:16
UML
Time Sensor
TimeSensor { exposedField SFTime cycleInterval 1
exposedField SFBool enabled TRUEexposedField SFBool loop FALSEexposedField SFTime startTime 0exposedField SFTime stopTime 0eventOut SFTime cycleTime eventOut SFFloat fraction_changedeventOut SFBool isActiveeventOut SFTime time
}
loop=TRUE
loop=FALSE
startTime stopTimecycleInterval
![Page 25: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/25.jpg)
2504/20/23 19:16
UML
Position Interpolator
PositionInterpolator {eventIn SFFloat set_fractionexposedField MFFloat key []exposedField MFVec3f keyValue []eventOut SFVec3f value_changed
}
y
z
x
Input: [ 0 1 ]
![Page 26: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/26.jpg)
2604/20/23 19:16
UML
Position AnimationExample
Def T Transform {translation 0 5 0children [
Shape {geometry Cone {}appearance Appearance {
material Material {diffuseColor 1 0 0
}}
}]
}Def P PositionInterpolator {
key [0, 0.5, 1]keyValue [ 0 0 0, 4 0 0, 0 0 0]
}Def TS TimeSensor {
stopTime -1loop TRUE
}ROUTE TS.fraction_changed TO P.set_fractionROUTE P.value_changed TO T.set_translation
![Page 27: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/27.jpg)
2704/20/23 19:16
UML
Java 3D:Class Hierarchy
![Page 28: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/28.jpg)
2804/20/23 19:16
UML
Java 3D:Viewing Classes
Locates a view within scene
Contains most ofview state
Contains informationabout physical screen
3D version ofAbstract WindowingToolkit
![Page 29: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/29.jpg)
2904/20/23 19:16
UML
Java 3D:Sample Code to Build Scene Graph
Shape3D myShape1 = new Shape3D(myGeometry1, myAppearance1); Shape3D myShape2 = new Shape3D(myGeometry2, myAppearance2);
BranchGroup myBranch = new BranchGroup(); myBranch.addChild(myShape1); myBranch.addChild(myShape2); myBranch.compile();
VirtualUniverse myUniverse = new VirtualUniverse(); Locale myLocale = new Locale(myUniverse); myLocale.addBranchGraph(myBranch);
![Page 30: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/30.jpg)
3004/20/23 19:16
UML
Java 3D:Scene Graph Built
![Page 31: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/31.jpg)
3104/20/23 19:16
UML
Java 3D;Node Class Hierarchy
![Page 32: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/32.jpg)
3204/20/23 19:16
UML
Java 3D “Hello Universe” Program
public class HelloUniverse extends Applet { public BranchGroup createSceneGraph() { // Create the root of the branch graph
BranchGroup objRoot = new BranchGroup();
// Create the TransformGroup node and initialize it to the // identity. Enable the TRANSFORM_WRITE capability so that // our behavior code can modify it at run time. Add it to // the root of the subgraph.
TransformGroup objTrans = new TransformGroup(); objTrans.setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE); objRoot.addChild(objTrans);
// Create a simple Shape3D node; add it to the scene graph.
objTrans.addChild(new ColorCube(0.4));
// Create a new Behavior object that will perform the // desired operation on the specified transform and add // it into the scene graph.
![Page 33: 111/22/2015 22:40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.](https://reader036.fdocuments.us/reader036/viewer/2022070404/56649f385503460f94c5541e/html5/thumbnails/33.jpg)
3304/20/23 19:16
UML
Java 3D“Hello Universe” Program, contd.
Transform3D yAxis = new Transform3D(); Alpha rotationAlpha = new Alpha(-1, 4000); RotationInterpolator rotator = new RotationInterpolator( rotationAlpha, objTrans, yAxis, 0.0f, (float) Math.PI*2.0f); BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0); rotator.setSchedulingBounds(bounds); objRoot.addChild(rotator);
// Have Java 3D perform optimizations on this scene graph. objRoot.compile();
return objRoot; }
public HelloUniverse() { <set layout of applet, construct canvas3d, add canvas3d>
// Create the scene; attach it to the virtual universe
BranchGroup scene = createSceneGraph(); SimpleUniverse u = new SimpleUniverse(canvas3d); u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(scene); } }