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.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-navn Field-navn Group-note:
Shape note Shape { 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 Cone Box { field SFVec3f size # (0, ) } Cone { field SFFloat bottomRadius 1 # (0,) field SFFloat height 2 # (0,) field SFBool side TRUE field SFBool bottom TRUE }
Material Material { exposedField SFFloat ambientIntensity 0.2 # [0,1] exposedField SFColor diffuseColor # [0,1] exposedField SFColor emissiveColor # [0,1] exposedField SFFloat shininess 0.2 # [0,1] exposedField SFColor specularColor # [0,1] exposedField SFFloat transparency 0 # [0,1] } Shape { appearance Appearance { material Material { emissiveColor 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" }
Transform Transform { eventIn MFNode addChildren eventIn MFNode removeChildren exposedField SFVec3f center # (-,) exposedField MFNode children [] exposedField SFRotation rotation # [-1,1],(-,) exposedField SFVec3f scale # (0,) exposedField SFRotation scaleOrientation # [-1,1],(-,) exposedField SFVec3f translation # (-,) field SFVec3f bboxCenter # (-,) field SFVec3f bboxSize # (0,) or -1,-1,-1 } Transform { translation rotation scale children [ USE FBOX ] } DEF FBOX Shape { appearance Appearance { material Material { } geometry Box { }
Browseropsætning NavigationInfo { 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.
Animation ROUTE SENSOR.touchTime TO SOUND.startTime
Touch og Sound Group { children [ Shape { appearance Appearance { material Material diffuseColor } 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 [ , , , , ] } DEF POSTGT Transform { translation children [ Shape { appearance Appearance { material Material { diffuseColor } geometry Sphere { } ROUTE TIMER.fraction_changed TO POSINT.set_fraction ROUTE 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 Position PositionInterpolator { 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 } geometry Sphere { } ] parameter [ "target= name_of_frame" ] description "Gaa til wrmlkule.html" url "wrmlkule.html" }
Viewpoint Viewpoint { position orientation fieldOfView 0.39 description "Camera 1" } world.wrl#Camera 1
Light DirectionalLight { exposedField SFColor color exposedField SFVec3f direction exposedField SFFloat intensity 1 exposedField SFBool on TRUE } PointLight { exposedField SFVec3f attenuation exposedField SFColor color exposedField SFFloat intensity 1 exposedField SFVec3f location exposedField SFBool on TRUE exposedField SFFloat radius 100 } SpotLight { exposedField SFVec3f attenuation exposedField SFFloat beamWidth exposedField SFColor color exposedField SFFloat cutOffAngle exposedField SFVec3f direction exposedField SFFloat intensity 1 exposedField SFVec3f location exposedField SFBool on TRUE exposedField SFFloat radius 100 }
Eks. #VRML V2.0 utf8 WorldInfo { title "t2" info ["bla."] } Background{ skyColor [ ] skyAngle [ 1.309, ] groundColor [ ] groundAngle [ 1.309, ] } NavigationInfo { #avatarSize [0.25, 1.6, 0.75] headlight FALSE speed 1.0 #type "WALK" visibilityLimit 0.0 }
Eks. Viewpoint { position orientation #fieldOfView 0.39 description "Normal" } Viewpoint { position orientation #fieldOfView 0.39 description "Kamera 2" }Viewpoint { position orientation #fieldOfView 0.39 description "Kamera 3" } Viewpoint { position orientation #fieldOfView 0.39 description "TopKamera" } Viewpoint { position orientation #fieldOfView 0.39 description "bundkamera" }
Eks DEF TIMER TimeSensor { cycleInterval 30 loop TRUE } Transform { rotation children [ DEF POSINT PositionInterpolator { key [0, 0.25, 0.5, 0.75, 1] keyValue [ , , , , ] } DEF POSTGT Transform { translation children [ Transform { scale rotation translation children [ Transform { rotation children [ Inline { url "XB-70.wrl" } ] } ] }]}]} ROUTE TIMER.fraction_changed TO POSINT.set_fraction ROUTE POSINT.value_changed TO POSTGT.set_translation
Eks Transform { scale translation children [ Inline { url "ppmskilt.wrl" } ] } #VRML V2.0 utf8 WorldInfo { title "Rotor skilt Per P Madsen" info ["(C) Copyright 2000 Per P. Madsen AAU" } NavigationInfo { type "NONE" } Viewpoint { position } 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" } NavigationInfo { type "NONE" } Viewpoint { position } DEF TIMER TimeSensor { cycleInterval 10 loop TRUE } Transform { children [