Introduction to VRML

Embed Size (px)

Citation preview

  • 7/25/2019 Introduction to VRML

    1/25

    Introduction to VRMLIntroduction to VRML

    ByBy

    Salman YussofSalman YussofDiego IglesiasDiego Iglesias

  • 7/25/2019 Introduction to VRML

    2/25

    What is VRML?What is VRML?

    VRML stands for Virtual Reality ModellingVRML stands for Virtual Reality Modelling

    Language and is pronounced vermil.Language and is pronounced vermil.

    It is a standard for delivering 3D renderingIt is a standard for delivering 3D rendering

    on the net, just like HTML is a standard foron the net, just like HTML is a standard for

    web pages.web pages.

    VRML is a subset of the Open InventorVRML is a subset of the Open Inventorstandard developed by SGI for their graphicsstandard developed by SGI for their graphics

    workstation.workstation.

  • 7/25/2019 Introduction to VRML

    3/25

    The World representationThe World representation

    VRML includes many of the things that go into making aVRML includes many of the things that go into making a

    world. It has a way of describing geometry which createsworld. It has a way of describing geometry which creates

    objects and spaces in which you can move around, as wellobjects and spaces in which you can move around, as well

    as light, texture and sound which can be approached andas light, texture and sound which can be approached and

    viewed from whatever angle.viewed from whatever angle.

    It is from this worldly imitation that VRML files get theirIt is from this worldly imitation that VRML files get their

    name. The files are called worlds and have .wrlname. The files are called worlds and have .wrl

    extension.extension.

  • 7/25/2019 Introduction to VRML

    4/25

    VRML 1.0VRML 1.0

    This is the first generation of VRML.This is the first generation of VRML.

    It describes the foundations of a world including geometry, lighting,It describes the foundations of a world including geometry, lighting,

    color, texture and linking.color, texture and linking.

    VRML 1.0 is designed to meet the following requirements:VRML 1.0 is designed to meet the following requirements: Platform independencePlatform independence

    ExtensibilityExtensibility

    Ability to work well over low-bandwidth connectionsAbility to work well over low-bandwidth connections

    No support for interactive behaviorsNo support for interactive behaviors

  • 7/25/2019 Introduction to VRML

    5/25

    VRML 2.0VRML 2.0

    This is the current generation of VRML.This is the current generation of VRML.

    It has a richer level for interactivity and includes supportIt has a richer level for interactivity and includes support

    for animation, spatial sound and scripting in addition tofor animation, spatial sound and scripting in addition to

    features that are already supported in VRML 1.0.features that are already supported in VRML 1.0.

    VRML Architecture Board made it official in March 1996VRML Architecture Board made it official in March 1996

  • 7/25/2019 Introduction to VRML

    6/25

    VRML97VRML97

    VRML 97 is the ISO standard for VRMLVRML 97 is the ISO standard for VRML

    It is developed based on VRML 2.0It is developed based on VRML 2.0

  • 7/25/2019 Introduction to VRML

    7/25

    Features in VRML97Features in VRML97

    More realism in static worldsMore realism in static worlds

    Sound objects with controllable attenuationSound objects with controllable attenuationAn efficient system to describe irregular ground terrainsAn efficient system to describe irregular ground terrainsExtrusion objects for advanced but compact modellingExtrusion objects for advanced but compact modellingA more powerful background coloring and panorama systemA more powerful background coloring and panorama systemA fog system allowing underwater and cloudy environments toA fog system allowing underwater and cloudy environments to

    be representedbe representedThe ability to use MPE video as a texture mapThe ability to use MPE video as a texture map

  • 7/25/2019 Introduction to VRML

    8/25

    Features in VRML97Features in VRML97

    !nteraction from sensors"!nteraction from sensors"

    #ollision detection gives the user a sense of substance as they#ollision detection gives the user a sense of substance as they

    move in the worldmove in the worldTouch sensors allow reactions to a users deliberate actionsTouch sensors allow reactions to a users deliberate actionsProximity sensors allow reactions to a user$s not so deliberateProximity sensors allow reactions to a user$s not so deliberate

    actionsactions

    %isibility sensors allow conservation of resources%isibility sensors allow conservation of resources

  • 7/25/2019 Introduction to VRML

    9/25

    Features in VRML97Features in VRML97

    Motion& behaviors and beyond"Motion& behaviors and beyond"

    !nterpolators provide engines to implement animation of any!nterpolators provide engines to implement animation of any

    sort'sort'Scripting in (avaScript or (ava allows everything from simpleScripting in (avaScript or (ava allows everything from simple

    logic devices to fully blown analytical engines providing alogic devices to fully blown analytical engines providing a

    wealth of complexity'wealth of complexity'

    Prototypes extend the existing variety of object types withPrototypes extend the existing variety of object types withefficient reuse and simple scene graph structure'efficient reuse and simple scene graph structure'A navigation information object provides the browser softwareA navigation information object provides the browser software

    with details of the speed and nature of the users movements inwith details of the speed and nature of the users movements in

    the world'the world'

  • 7/25/2019 Introduction to VRML

    10/25

    Writing VRML descriptionsWriting VRML descriptions

    VRML code is simply a text fle, case sensitiveVRML code is simply a text fle, case sensitive

    Header:Header: !VRML V"#$ ut%&!VRML V"#$ ut%&

    'omments indicated (y )!* sign'omments indicated (y )!* sign

    +erminology:+erminology: odes: a -orld is made up o% nodes -.ic. are typesodes: a -orld is made up o% nodes -.ic. are types

    o% o(/ectso% o(/ects

    Fields: descri(e properties o% a nodeFields: descri(e properties o% a node

  • 7/25/2019 Introduction to VRML

    11/25

    0xample0xample

    )%*M+ %,'- utf.

    /orld!nfo0

    title1Example 213

    4E5 5678 Shape0

    appearanceAppearance 0

    materialMaterial 0 diffuse#olor - -'9 -

    3

    3

    geometry6ox 0

    3

    3

    :ode5ield

    ;uses default valuest doesn=t cast lig.t on any ot.er o(/ects

    t.oug.t.oug.

    am(ient>ntensity:am(ient>ntensity:+.e amount o% am(ient lig.t t.at t.e+.e amount o% am(ient lig.t t.at t.eo(/ect re?ectso(/ect re?ects

    s.ininess:s.ininess: Ho- re?ective t.e o(/ect isHo- re?ective t.e o(/ect is

    transparency:transparency: Ho- transparent t.e o(/ect is# ote, someHo- transparent t.e o(/ect is# ote, some(ro-sers -ill not support partly@transparent o(/ects#(ro-sers -ill not support partly@transparent o(/ects#

  • 7/25/2019 Introduction to VRML

    14/25

    +rans%ormations+rans%ormations

    Aistances measured in meters BconventionCAistances measured in meters BconventionC

    ngles measured in radiansngles measured in radians

    +rans%ormation types:+rans%ormation types: +ranslation, Rotation, and 1caling+ranslation, Rotation, and 1caling

    pplied in %ollo-ing order Buse nesting %orpplied in %ollo-ing order Buse nesting %or

    customCcustomC 1cale, t.en Rotate, t.e +ranslate1cale, t.en Rotate, t.e +ranslate

    0xample:0xample:

    Transform 0

    translation 2 2 2 rotation - 2 - -'=.

    scale , 2 ,

    children >

    ?SE 5678

    @

  • 7/25/2019 Introduction to VRML

    15/25

    0xample 0xample )%*M+ %,'- utf.)%*M+ %,'- utf.

    Transform 0Transform 0

    children >children >

    :avigation!nfo 0 headlight 5A+SE 3 ) /ell add our own light:avigation!nfo 0 headlight 5A+SE 3 ) /ell add our own light

    4irectional+ight 0 ) 5irst child4irectional+ight 0 ) 5irst child

    direction - - B2 ) +ight illuminating the scenedirection - - B2 ) +ight illuminating the scene 33

    Transform 0 ) Second child B a red sphereTransform 0 ) Second child B a red sphere

    translation C - 2translation C - 2

    children >children >

    Shape 0Shape 0

    geometry Sphere 0 radius ,'C 3geometry Sphere 0 radius ,'C 3 appearance Appearance 0appearance Appearance 0

    material Material 0 diffuse#olor 2 - - 3 ) *edmaterial Material 0 diffuse#olor 2 - - 3 ) *ed

    33

    33

    @@

    33

    ; D

  • 7/25/2019 Introduction to VRML

    16/25

    0xample "0xample "

    )%*M+ %,'- utf.)%*M+ %,'- utf.

    Transform 0Transform 0

    children >children >

    4E5 (oe Shape 0 geometry Sphere 03 34E5 (oe Shape 0 geometry Sphere 03 3

    Transform 0Transform 0

    translation , - -translation , - - children 4E5 (oe Shape 0 geometry Sphere 0 radius ', 3 3children 4E5 (oe Shape 0 geometry Sphere 0 radius ', 3 3

    33

    Transform 0Transform 0

    translation B, - -translation B, - -

    children ?SE (oechildren ?SE (oe

    33

    @@33

    http://c/windows/desktop/vrml%20examples/ex2.vrml
  • 7/25/2019 Introduction to VRML

    17/25

    0xample 60xample 6)%*M+ %,'- utf.

    P*7T7 Two#olorTable > field S5#olor leg#olor '. ' '=

    field S5#olor top#olor 'F 'F '2 @

    0

    Transform 0

    children >

    Transform 0 ) table top

    translation - -'F -

    children Shape 0

    appearance Appearance 0

    material Material 0 diffuse#olor !S top#olor 3

    3

    geometry 6ox 0 siGe 2', -', 2', 3

    3

    3

    Transform 0 ) first table leg

    translation B'9 - B'9 children

    4E5 +eg Shape 0

    appearance Appearance 0

    material Material 0 diffuse#olor !S leg#olor 3

    3

    geometry #ylinder 0 height 2 radius '2 3

    3

    3

    Transform 0 ) another table leg

    translation '9 - B'9

    children ?SE +eg 3

    Transform 0 ) another table leg

    translation B'9 - '9

    children ?SE +eg

    3

    Transform 0 ) another table leg

    translation '9 - '9

    children ?SE +eg

    3

    @ ) End of root Transforms children 3 ) End of root Transform

    3 ) End of prototype

    ) The prototype is now defined' Although it contains a

    ) number of nodes& only the leg#olor and top#olor fields

    ) are public' !nstead of using the default leg#olor and

    ) top#olor& this instance of the table has red legs and

    ) a green top"

    Two#olorTable 0

    leg#olor 2 - - top#olor - 2 -

    3

    :avigation!nfo 0 type 1E8AM!:E1 3 ) ?se the Examine viewer

  • 7/25/2019 Introduction to VRML

    18/25

    0xample D0xample D

    )%*M+ %,'- utf.

    4E5 7pen%ault Script 0

    ) 4eclarations of whats in this Script node"

    event!n S5Time open%ault

    event!n S56ool combinationEntered

    event7ut S5Time vault?nlocked

    field S56ool unlocked 5A+SE

    ) !mplementation of the logic"

    url 1javascript"

    function combinationEntered;value< 0 unlocked H valueI 3

    function open%ault;value< 0

    if ;unlocked< vault?nlocked H valueI

    31

    3

    Shape 0

    appearance Appearance 0 material Material 0 diffuse#olor 2 - - 3

    3

    geometry Sphere 0 3

    3

    Sound 0

    source 4E5 #lick Audio#lip 0

    url 1click'wav1

    stopTime 2

    3

    min5ront 2---

    max5ront 2--- min6ack 2---

    max6ack 2---

    3

    4E5 TS TouchSensor 0 3

    *7?TE TS'is7ver T7 7pen%ault'combinationEntered

    *7?TE TS'touchTime T7 7pen%ault'open%ault

    *7?TE 7pen%ault'vault?nlocked T7 #lick'startTime

    http://c/WINDOWS/DESKTOP/vrml%20examples/ex4.vrmlhttp://c/WINDOWS/DESKTOP/vrml%20examples/ex4.vrmlhttp://c/WINDOWS/DESKTOP/vrml%20examples/ex4.vrml
  • 7/25/2019 Introduction to VRML

    19/25

    dditional 0xamplesdditional 0xamples

    >nterpolation>nterpolation

    >nteraction>nteraction

    +our+our Aistance 1ensorAistance 1ensor

    Erap.ics BCErap.ics BC

    Erap.ics B"CErap.ics B"C

    Erap.ics B6CErap.ics B6C

    http://c/WINDOWS/DESKTOP/vrml%20examples/interpolator.wrlhttp://c/WINDOWS/DESKTOP/vrml%20examples/interpolator.wrlhttp://c/WINDOWS/DESKTOP/vrml%20examples/life.wrlhttp://c/WINDOWS/DESKTOP/vrml%20examples/life.wrlhttp://c/WINDOWS/DESKTOP/vrml%20examples/tour.vrmlhttp://c/WINDOWS/DESKTOP/vrml%20examples/tour.vrmlhttp://c/WINDOWS/DESKTOP/vrml%20examples/tour.vrmlhttp://c/WINDOWS/DESKTOP/vrml%20examples/life.wrlhttp://c/WINDOWS/DESKTOP/vrml%20examples/interpolator.wrl
  • 7/25/2019 Introduction to VRML

    20/25

    cno-ledgementscno-ledgements

    0xample VRML code %rom0xample VRML code %rom .ttp:GG---#vapourtec.#comGvrmlguideG.ttp:GG---#vapourtec.#comGvrmlguideG

    .ttp:GG---#-e(6d#orgG1pecifcationsGVRML97GpartGe.ttp:GG---#-e(6d#orgG1pecifcationsGVRML97GpartGe

    xamples#.tmlxamples#.tml

  • 7/25/2019 Introduction to VRML

    21/25

    Re%erencesRe%erences

    VRML 'onsortiumGWe(6AVRML 'onsortiumGWe(6A .ttp:GG---#vrml#orgG.ttp:GG---#vrml#orgG

    VRML repository:VRML repository: .ttp:GGvrml#sdsc#eduG.ttp:GGvrml#sdsc#eduG

    VRML #$ 1pecifcationVRML #$ 1pecifcation .ttp:GG---#vrml#orgGVRML#$Gvrml$c#.tml.ttp:GG---#vrml#orgGVRML#$Gvrml$c#.tml

    VRML "#$ 1pecifcationVRML "#$ 1pecifcation .ttp:GG---#vrml#orgGVRML"#$GF>LG.ttp:GG---#vrml#orgGVRML"#$GF>LG

    VRML97 1pecifcationVRML97 1pecifcation .ttp:GG---#-e(6d#orgG1pecifcationsGVRML97G.ttp:GG---#-e(6d#orgG1pecifcationsGVRML97G

  • 7/25/2019 Introduction to VRML

    22/25

    0xamples0xamples

    VRML97 0xamplesVRML97 0xamples .ttp:GG---#-e(6d#orgG1pecifcationsGVRML97GpartGe.ttp:GG---#-e(6d#orgG1pecifcationsGVRML97GpartGe

    xamples#.tmlxamples#.tml

    6A We( Erap.ics sing VRML 2oo 0xamples6A We( Erap.ics sing VRML 2oo 0xamples .ttp:GG---#iup#eduG/acrossGgrap.icsGmy(oo#.tmlx.ttp:GG---#iup#eduG/acrossGgrap.icsGmy(oo#.tmlx

    Lins to good examples:Lins to good examples: .ttp:GG---#6d@design#comGvrmlsite#.tml.ttp:GG---#6d@design#comGvrmlsite#.tml

  • 7/25/2019 Introduction to VRML

    23/25

    +utorials+utorials

    VRML97 +utorialVRML97 +utorial .ttp:GG---#vapourtec.#comGvrmlguideG.ttp:GG---#vapourtec.#comGvrmlguideG

    VRML Wors +utorialVRML Wors +utorial .ttp:GG.ome#.i-aay#netGcrispenGvrml-orsGtutorialsG.ttp:GG.ome#.i-aay#netGcrispenGvrml-orsGtutorialsG

    index#.tmlindex#.tml

    'osmo VRML +utorial'osmo VRML +utorial .ttp:GGcosmoso%t-are#comGdeveloperGtutorials#.tml.ttp:GGcosmoso%t-are#comGdeveloperGtutorials#.tml

    VRML Repository +utorial linsVRML Repository +utorial lins .ttp:GGvrml#sdsc#eduGcgi@(inGdisplay#cgiI.ttp:GGvrml#sdsc#eduGcgi@(inGdisplay#cgiI

    categoryJ+utorialsK@KVRMLcategoryJ+utorialsK@KVRML

  • 7/25/2019 Introduction to VRML

    24/25

    uestions Band ns-ersCuestions Band ns-ersC

    : Ho- to defne t.e tra/ectory o% t.e [email protected].: Ho- to defne t.e tra/ectory o% t.e [email protected].

    exampleIexampleI

    : +.ere are t-o -ays in -.ic. to implement t.e tour:: +.ere are t-o -ays in -.ic. to implement t.e tour:

    sing /avascript to control t.e vie-er*s camera positionsing /avascript to control t.e vie-er*s camera position sing VRML sensors, in particular t.e time sensorsing VRML sensors, in particular t.e time sensor

    +.e +our example -as implemented using t.e time+.e +our example -as implemented using t.e time

    sensor approac.sensor approac. n array o% tour positions is defned toget.er -it. a -ay ton array o% tour positions is defned toget.er -it. a -ay to

    interpolate (et-een t.eminterpolate (et-een t.em touc. sensor determines -.en t.e timer is started touc. sensor determines -.en t.e timer is started

    0ac. tic o% t.e timer is routed to t.e position interpolator0ac. tic o% t.e timer is routed to t.e position interpolator

    -.ic. sets a ne- orientation and translation-.ic. sets a ne- orientation and translation

  • 7/25/2019 Introduction to VRML

    25/25

    +our 0xample+our 0xample

    4E5 uideP! Position!nterpolator 0

    key > -& -',& -'C& -'9& -'F& -'.& -'J& 2 @

    key%alue > - - -& - - B9&

    , - B9& , F B29

    B F B29& B - B9&

    - - B9& - - -

    @

    3

    Relevant source codeRelevant source code4E5 uide*! 7rientation!nterpolator 0

    key > -& -',& -'C& -'9& -'F& -'.& -'J& 2 @

    key%alue > - 2 - -& - 2 - -&

    - 2 - 2',& - 2 - C&

    - 2 - C'9& - 2 - 9&

    - 2 - -& - 2 - -&

    @

    3

    4E5 TS TimeSensor 0 cycle!nterval C- 3 ) C- second tour

    *7?TE StartTour'touchTime T7 TS'startTime

    *7?TE TS'fractionKchanged T7 uideP!'setKfraction

    *7?TE TS'fractionKchanged T7 uide*!'setKfraction

    *7?TE uideP!'valueKchanged T7 uideTransform'setKtranslation

    *7?TE uide*!'value changed T7 uideTransform'set rotation