3d sprog x3d: et 3d sprog til at definere realtime 3d grafik der kan formidles via www. – xml...
TRANSCRIPT
3D sprog
X3D: Et 3D sprog til at definere realtime 3D grafik der kan formidles via WWW.– XML integreret– Baseret på VRML– Relativt nyt så der findes endnu ikke godt
tutorials på nettet. – Så lad os kikke på stamfaderen nemlig
VRML.
Se evt. WEB3D CONSORTIUM.
Virtual Reality Modeling Language VRML
● VRML er et sproget til generering af 3D grafik.
● VRML fortolkes og vises af en VRML-browser.
● VRML-browsere kan være standalone eller WWW-browser plug-ins.
● Vha browseren kan man bevæge sig rundt i den genererede 3D grafik.
● 3D grafikken består af en rækker 3D objekter.
● Disse 3D objekter kan være standart former eller brugerdefinerede former.
● Hvert objekt placeres og evt roteres i de tre dimensioner.
● Hvert objekt har en valgt overflade.
● Objekterne kan animeres mht form, placering, rotation, skalering og farve
● Objekter kan tilknyttes et ''Anchor'' og andre musestyrede handlinger.
Scene Graph
x
y
z
Man ser default fra Z-axen og med headlight.
● Geometry● Appearance● Transform
Nodes, Fields
#VRML V2.0 utf8
Group { children [ # En liste af notes ]}
Note-navnField-navn
Group-note:
Shape noteShape { appearance Appearance { material Material { } } geometry Box { }}
Appearance { exposedField SFNode material NULL exposedField SFNode texture NULL exposedField SFNode textureTransform NULL}
geometry notes:
● Box ● Cone ● Cylinder ● ElevationGrid ● Extrusion ● IndexedFaceSet ● IndexedLineSet ● PointSet ● Sphere ● Text
Box og ConeBox { field SFVec3f size 2 2 2 # (0, )}
Cone { field SFFloat bottomRadius 1 # (0,) field SFFloat height 2 # (0,) field SFBool side TRUE field SFBool bottom TRUE}
MaterialMaterial { exposedField SFFloat ambientIntensity 0.2 # [0,1] exposedField SFColor diffuseColor 0.8 0.8 0.8 # [0,1] exposedField SFColor emissiveColor 0 0 0 # [0,1] exposedField SFFloat shininess 0.2 # [0,1] exposedField SFColor specularColor 0 0 0 # [0,1] exposedField SFFloat transparency 0 # [0,1]}
Shape { appearance Appearance { material Material { emissiveColor 0 0.8 0 transparency 0.5 } } geometry Box { }}
ambientIntensity: The amount of ambient light that the object reflects. diffuseColor: The normal colour of the object. emissiveColor: The object 'glows' with a light of its own of this colour. shininess: How reflective the object is. specularColor: The colour of highlights on shiny objects. transparency: How transparent the object is.
ambientIntensity: The amount of ambient light that the object reflects. diffuseColor: The normal colour of the object. emissiveColor: The object 'glows' with a light of its own of this colour. shininess: How reflective the object is. specularColor: The colour of highlights on shiny objects. transparency: How transparent the object is.
Texture ImageTexture, MovieTexture, or PixelTexture
ImageTexture { exposedField MFString url [] field SFBool repeatS TRUE field SFBool repeatT TRUE}
Browsere understøtter: JPEG og PNG. Browsere understøtter ofte også: CGM og GIF
Browsere understøtter: JPEG og PNG. Browsere understøtter ofte også: CGM og GIF
Appearance { texture ImageTexture { url "brick.jpg" }}
TransformTransform { eventIn MFNode addChildren eventIn MFNode removeChildren exposedField SFVec3f center 0 0 0 # (-,) exposedField MFNode children [] exposedField SFRotation rotation 0 0 1 0 # [-1,1],(-,) exposedField SFVec3f scale 1 1 1 # (0,) exposedField SFRotation scaleOrientation 0 0 1 0 # [-1,1],(-,) exposedField SFVec3f translation 0 0 0 # (-,) field SFVec3f bboxCenter 0 0 0 # (-,) field SFVec3f bboxSize -1 -1 -1 # (0,) or -1,-1,-1}
Transform { translation 1 1 1 rotation 0 1 0 0.78 scale 2 1 2 children [ USE FBOX ]}
DEF FBOX Shape { appearance Appearance { material Material { } } geometry Box { }}
BrowseropsætningNavigationInfo { eventIn SFBool set_bind exposedField MFFloat avatarSize [0.25, 1.6, 0.75] exposedField SFBool headlight TRUE exposedField SFFloat speed 1.0 exposedField MFString type "WALK" exposedField SFFloat visibilityLimit 0.0 eventOut SFBool isBound} "WALK"
where the user walks around and is affected by gravity, "FLY"
where the user moves around unaffected by gravity, "EXAMINE"
where the user remains static, but can rotate the world around to view it from various angles, and
"NONE"where the user has no movement controls at all.
"WALK"where the user walks around and is affected by gravity,
"FLY"where the user moves around unaffected by gravity,
"EXAMINE"where the user remains static, but can rotate the world around to view it from various angles, and
"NONE"where the user has no movement controls at all.
AnimationROUTE SENSOR.touchTime TO SOUND.startTime
Touch og Sound
Group { children [ Shape { appearance Appearance { material Material diffuseColor 1 0 0 } } geometry Sphere { radius 3.0 } } DEF SNDTOUCH TouchSensor {} Sound { minFront 10 minBack 10 maxFront 50 maxBack 50 source DEF SOUND AudioClip { url "pop.wav" } } ]}
ROUTE SNDTOUCH.touchTime TO SOUND.startTime
Interpolators og Animation
DEF TIMER TimeSensor { cycleInterval 10 loop TRUE}
DEF POSINT PositionInterpolator { key [0, 0.25, 0.5, 0.75, 1] keyValue [1 4 -10, 1 2 -10, -1 2 -10, -1 4 -10, 1 4 -10 ] }DEF POSTGT Transform { translation 0 3 -10 children [ Shape { appearance Appearance { material Material { diffuseColor 1 0 1 } } geometry Sphere { } }ROUTE TIMER.fraction_changed TO POSINT.set_fractionROUTE POSINT.value_changed TO POSTGT.set_translation
Time og Position TimeSensor { exposedField SFTime cycleInterval 1 exposedField SFBool enabled TRUE exposedField SFBool loop FALSE exposedField SFTime startTime 0 exposedField SFTime stopTime 0 eventOut SFTime cycleTime eventOut SFFloat fraction_changed eventOut SFBool isActive eventOut SFTime time}
Time og PositionPositionInterpolator { eventIn SFFloat set_fraction exposedField MFFloat key [] exposedField MFVec3f keyValue [] eventOut SFVec3f value_changed}
OrientationInterpolator { eventIn SFFloat set_fraction exposedField MFFloat key [] exposedField MFRotation keyValue [] eventOut SFRotation value_changed}
ColorInterpolator { eventIn SFFloat set_fraction exposedField MFFloat key [] exposedField MFColor keyValue [] eventOut SFColor value_changed}
JavaScript
Script { eventIn SFBool input field SFBool boolValue TRUE eventOut SFBool output url "javascript: function input(value, time) { if (value==boolValue) output = value; }}
●Java●VRMLScript●ECMAscript
Anchor
Anchor { children [ Shape { appearance Appearance { material Material { diffuseColor 1 0 1 } } geometry Sphere { } ] parameter [ "target= name_of_frame" ] description "Gaa til wrmlkule.html" url "wrmlkule.html"}
Viewpoint
Viewpoint { position 0 5 5 orientation 1 0 0 0.39 fieldOfView 0.39 description "Camera 1"}
world.wrl#Camera 1
LightDirectionalLight { exposedField SFColor color 1 1 1 exposedField SFVec3f direction 0 0 -1 exposedField SFFloat intensity 1 exposedField SFBool on TRUE}
PointLight { exposedField SFVec3f attenuation 1 0 0 exposedField SFColor color 1 1 1 exposedField SFFloat intensity 1 exposedField SFVec3f location 0 0 0 exposedField SFBool on TRUE exposedField SFFloat radius 100}
SpotLight { exposedField SFVec3f attenuation 1 0 0 exposedField SFFloat beamWidth 1.570796 exposedField SFColor color 1 1 1 exposedField SFFloat cutOffAngle 0.785398 exposedField SFVec3f direction 0 0 -1 exposedField SFFloat intensity 1 exposedField SFVec3f location 0 0 0 exposedField SFBool on TRUE exposedField SFFloat radius 100}
Eks.#VRML V2.0 utf8
WorldInfo { title "t2" info ["bla."]}
Background{ skyColor [ 0.0 0.2 0.7 0.0 0.5 1.0 1.0 1.0 1.0 ] skyAngle [ 1.309, 1.571 ]
groundColor [ 0.1 0.10 0.0 0.4 0.25 0.2 0.6 0.60 0.6 ] groundAngle [ 1.309, 1.571 ] }
NavigationInfo { #avatarSize [0.25, 1.6, 0.75] headlight FALSE speed 1.0 #type "WALK" visibilityLimit 0.0}
Eks.Viewpoint { position -1 1 10 orientation 1 0 0 0 #fieldOfView 0.39 description "Normal"}Viewpoint { position 10 1 0 orientation 0 1 0 1.571 #fieldOfView 0.39 description "Kamera 2"}Viewpoint { position -1 1 -10 orientation 0 1 0 3.14 #fieldOfView 0.39 description "Kamera 3"}Viewpoint { position -1 10 2.5 orientation 1 0 0 -1.3 #fieldOfView 0.39 description "TopKamera"}Viewpoint { position -1 -2 4 orientation 1 0 0 0.7 #fieldOfView 0.39 description "bundkamera"}
EksDEF TIMER TimeSensor { cycleInterval 30 loop TRUE}
Transform { rotation 0 1 0 .26 children [ DEF POSINT PositionInterpolator { key [0, 0.25, 0.5, 0.75, 1] keyValue [ 0 0 -250, 0 0 -150, 0 0 -50, 0 0 50, 0 0 150 ] }
DEF POSTGT Transform { translation 0 0 -50 children [ Transform { scale 1 0.7 0.7 rotation 1 0 0 -1.56
translation 0 4.9 0 children [ Transform { rotation 0 0 1 1.56 children [ Inline { url "XB-70.wrl" } ] } ]}]}]}
ROUTE TIMER.fraction_changed TO POSINT.set_fractionROUTE POSINT.value_changed TO POSTGT.set_translation
EksTransform { scale 0.5 .5 .5 translation -3 -0.5 0 children [ Inline { url "ppmskilt.wrl" } ]}
#VRML V2.0 utf8
WorldInfo { title "Rotor skilt Per P Madsen" info ["(C) Copyright 2000 Per P. Madsen AAU" "[email protected]"]}
NavigationInfo { type "NONE"}
Viewpoint { position 0 0.5 4.5}
DEF TIMER TimeSensor { cycleInterval 10 loop TRUE}
Transform { children [ .......................
#VRML V2.0 utf8
WorldInfo { title "Rotor skilt Per P Madsen" info ["(C) Copyright 2000 Per P. Madsen AAU" "[email protected]"]}
NavigationInfo { type "NONE"}
Viewpoint { position 0 0.5 4.5}
DEF TIMER TimeSensor { cycleInterval 10 loop TRUE}
Transform { children [ .......................