VRML (2) - Virtual Reality Markup Language (2)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Virtual Reality Markup Language (2) Understanding Shape Appearance Recall that Shape nodes describe: Appearance nodes describe: Shape { geometry . . . appearance . . . } geometry form, or structure appearance color and texture Shape { appearance Appearance { material . . . } geometry . . . } material properties color, transparency, etc. more . . . Understanding Materials A Material node controls: diffuse color main shading color emissive color glowing color transparency opaque or not more . . . Material { diffuseColor . . . emissiveColor . . . transparency . . . } Understanding Colors Colors specify: Color Red Green Blue A mixture of red, green, and blue light Values between 0.0 (none) and 1.0 (lots) White 1.0 1.0 1.0 Black 0.0 0.0 0.0 Yellow 1.0 1.0 0.0 Magenta 1.0 0.0 1.0 Brown 0.5 0.2 0.0 Appearance and Material Nodes The Appearance node controls overall shape appearance The Material node controls overall material properties including: Shading color Glow color Transparency Understanding Basic Groups The Group node creates a basic group Every child node in the group is displayed Group { children [ . . . ] } Understanding Switch Groups The Switch group node creates a switched group Only one child node in the group is displayed You select which child Switch { whichChoice 0 choice [ . . . ] } * The Switch node creates a group with * 1 choice used Understanding Transform Groups The Transform group node creates a group with its own coordinate system Every child node in the group is displayed Transform { translation . . . rotation . . . scale . . . children [ . . . ] } * The Transform node creates a group with a * new coordinate system Understanding Billboard Groups The Billboard group node creates a group with a special coordinate system Every child node in the group is displayed Coordinate system is turned to face viewer Billboard { axisOfRotation . . . children [ . . . ] } * The Billboard node creates a group with a * coordinate system that rotates to face the viewer Understanding Billboard Rotation Axes A rotation axis defines a pole to rotate round Similar to a Transform node's rotation field, but no angle (auto computed) Sample Billboard Group Group { children [ Billboard { axisOfRotation 0.0 1.0 0.0 children [ ... ] }, Transform { . . . } ] } Sample Billboard #VRML V2.0 utf8 Group { children [ Billboard { axisOfRotation 0.0 1.0 0.0 children [ DEF Caf Shape { appearance DEF GlowWhite Appearance { material Material { emissiveColor 1.0 1.0 1.0 diffuseColor 0.0 0.0 0.0 } } geometry Text { string "Caf" fontStyle FontStyle { justify "MIDDLE" } } }, DEF BlueDisk Transform { translation 0.0 0.3 0.10 rotation 1.0 0.0 0.0 1.57 children Shape { appearance Appearance { material Material { diffuseColor 0.0 0.3 0.8 } } geometry Cylinder { radius 1.3 height 0.1 } } }, DEF WhiteDisk Transform { translation 0.0 0.3 0.10 rotation 1.0 0.0 0.0 1.57 children [ Shape { appearance USE GlowWhite geometry Cylinder { radius 1.4 height 0.08 } } ] DEF RedWhiteBoxes Transform { translation 0.0 0.3 0.10 children [ Shape { appearance Appearance { material Material { diffuseColor 0.8 0.0 0.0 } } geometry Box { size 4.0 1.2 0.06 } }, Shape { appearance USE GlowWhite geometry Box { size 4.2 1.4 0.04 } } ] } DEF Pole Transform { translation 0.0 3.1 0.10 children Shape { appearance DEF Gray Appearance { material Material { diffuseColor 0.6 0.6 0.6 } } geometry Box { size 0.4 4.0 0.4 } } }, DEF PoleBase transform { translation 0.0 5.2 0.10 } ] } }, children Shape { appearance USE Gray geometry Box { size 1.0 0.2 1.0 } } DEF Ground Transform { translation 0.0 5.35 0.10 children Shape { appearance USE Gray geometry Box { size 10.0 0.1 10.0 } } Understanding Inline Node The Inline node creates a special group Inline { url "table.wrl" } Children are read from a VRML file selected by a URL Every child node in the group is displayed A Sample Inlined File: . . . Inline { url "table.wrl" }, . . . Transform { translation . . . children [ Inline { url "chair.wrl" } ] }, . . . Inline group children are read from a VRML file selected by a URL Inline Sample 1 #VRML V2.0 utf8 Group { children [ Shape { appearance Apperance { material material { diffuseColor 0.0 1.0 0.0 } } Geometry Box { size 50.0 0.1 50.0 } }, }, }, Transform{ translation 0.0 0.0 4.0 rotation 0.0 1.0 0.0 3.14 children USE ArchRow } Transform { translation 0.0 0.0 4.0 children DEF ArchRow Inline { bboxSize 5.0 8.0 10.0 bboxCenter 1.0 4.0 5.0 url "archrow.wrl" Inline Sample 1 (cont.) Transform { translation 4.0 0.0 0.0 rotation 0.0 1.0 0.0 1.57 children USE ArchRow }, Transform { translation 4.0 0.0 0.0 rotation 0.0 1.0 0.0 1.57 children USE ArchRow } } NOTES: bboxSize specifies the size of a bounding box sufficiently large to contain all of the shapes within the group. bboxCenter specifies the center of the bounding box Understanding Anchor Node The Anchor node creates a group Every child node in the group is displayed Selecting any child jumps to VRML file specified by URL The anchor can have a description string A Sample Anchor Anchor { url "stairway.wrl" } description "Floating Stairs" children [ . . . ] } Building Text Shape Text geometry is built using a Text geometry node in a Shape node Font style is controlled using a FontStyle node Text Node : Text { string [ ] #one/more lines of text to build length [ ] #desired length in VRML unit maxExtent 0.0 #maximum length in VRML unit fontStyle NULL #looks of the font } Building Text Shape Specifying Text Strings Text strings list the text to build Each string is built on its own line or column Text { string [ "SIGGRAPH 96", "Conference" ] } Specifying Font Style Font styles have: family serif, sans, or typewriter style bold, italic, both, or none size and spacing character size and spacing FontStyle { family "SERIF" style "BOLD" size 1.0 spacing 1.0 } Building Text Shape Specifying Font Direction Font styles also have: justification begin, middle, end direction left/right, up/down FontStyle { justify "BEGIN" horizontal TRUE leftToRight TRUE topToBottom TRUE } A Sample Text Shape Shape { . . . geometry Text { string [ "SIGGRAPH 2006", "Conference" ] fontStyle FontStyle { style "BOLD" } } } Sample 1 - Building Text #VRML V2.0 utf8 Shape { } geometry Text { appearance Appearance { material Material { } string "First Class" fontStyle FontStyle { size 0.5 } } } Sample 2 - Building Text #VRML V2.0 utf8 Shape { } geometry Text { } appearance Appearance { material Material { } string [ "First Class", "Graduate" ] maxExtent 4.0 } Sample 3 - Building Text #VRML V2.0 utf8 Shape { } geometry Text { } appearance Appearance { material Material { } string [ "First Class", "First Class" ] length [ 3.0, 4.0 ] } Transforming Shapes The Transform node creates a new coordinate system relative to its parent coordinate system. Shapes created as children of the Transform node are built relative to the new coordinate system's origin. Transform node fields do translation rotation scale Understanding Coordinate Systems A VRML file builds components for a world A file's world components are built in the file's world coordinate system By default, all shapes are built at the origin of the world coordinate system Understanding Coordinate System Transforms A transform creates a coordinate system that is relative to a parent coordinate system Shapes built in the new coordinate system are positioned, rotated, and scaled along with it Positioned Rotated Scaled Specifying Transforms A Transform group node controls: translation position rotation orientation scale size Transform { translation . . . rotation . . . scale . . . children [ . . . ] } Translating A Coordinate System Translation positions a coordinate system in X, Y, and Z Transform { translation 2.0 0.0 0.0 children [ . . . ] } E.g. #VRML V2.0 utf8 Transform { translation 2.0 0.0 0.0 children [ Shape { appearance Apprearance { geometry Cylinder { } } material material { } } Rotating A Coordinate System Rotation orients a coordinate system about a rotation axis by a rotation angle Angles are measured in radians Transform { # X Y Z Angle rotation 0.0 0.0 1.0 0.52 children [ . . . ] } Understanding Rotation Axes A rotation axis defines a pole to rotate around Typical rotations are about the X, Y, or Z axes: Rotate about: Like the Earth's NorthSouth pole XAxis = 1.0 0.0 0.0 YAxis = 0.0 1.0 0.0 ZAxis = 0.0 0.0 1.0 Rotation Sample #VRML V2.0 utf8 Group { children [ Shape { Transform { translation 2.0 0.0 0.0 rotation 1.0 0.0 0.0 0.7 appearance DEF White Appearance { center 0.0 0.15 0.0 material Material { } children [ Shape { } appearance Apprearance { geometry Cylinder { material Material { } geometry Cylinder { } radius 0.1 } height 0.01 ] } } } ] } }, Reference Introducing VRML Syntax http://www.inrialpes.fr/sherpa/people/genoud/S Andrea L. Ames et al. (1997) VRML Sourcebook 2.0. ...
View Full Document

This note was uploaded on 02/06/2012 for the course FACULTY OF WXGE6320 taught by Professor Noraini during the Winter '09 term at University of Malaya.

Ask a homework question - tutors are online