Extensible 3D (X3D) Graphics Examples Don Brutzman Web3D 2007, Perugia Italy, 15 April 2007 Naval Postgraduate School Monterey California USA

Slides:



Advertisements
Similar presentations
XP New Perspectives on Microsoft Office Word 2003 Tutorial 7 1 Microsoft Office Word 2003 Tutorial 7 – Collaborating With Others and Creating Web Pages.
Advertisements

© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 1 – Introduction to VRML.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
1 Frameworks. 2 Framework Set of cooperating classes/interfaces –Structure essential mechanisms of a problem domain –Programmer can extend framework classes,
Chapter Day 5. © 2007 Pearson Addison-Wesley. All rights reserved2-2 Agenda Day 5 Questions from last Class?? Problem set 1 Posted  Introduction on developing.
CS 290C: Formal Models for Web Software Lecture 10: Language Based Modeling and Analysis of Navigation Errors Instructor: Tevfik Bultan.
© Richard Jones, 2009 CO641 Computer Graphics 1 CO641 Computer Graphics and Animation X3d / VRML Richard Jones SW107
Viewpoint { eventIn SFBool set_bind exposedField SFFloat fieldOfView # (0,  ) exposedField SFBool jump TRUE exposedField SFRotation orientation.
Introduction to VRML By Salman Yussof Diego Iglesias.
What Is VRML? VRML is: Stands for Virtual Reality Modeling Language A simple text language for describing 3-D shapes and interactive environments VRML.
Virtual reality interfaces in connection with building process simulations. Prof. Nash Dawood Centre for Construction Innovation Research University of.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
An Overview of VRML §Scene Graph Structure VRML files describe 3D objects and worlds using a hierarchical scene graph. Entities in the scene graph are.
© De Montfort University, D Graphics and VRML Howell Istance and Chris Hand* De Montfort University * now at
Cse591 Spring 981 VRML Basics The basic elements of VRML files are nodes. Every type of node has a set of fields associated with it. –Common single-valued.
University College Dublin1 Scope ROOT Light SourceTransform Light SourceSphere.
3D on-line representations Jan Valcik → introduction, main idea → VRML 97 → building of virtual worlds → VRML 97 at work → X3D → MUDVR → animations, navigation.
Chapter 1 Program Design
VRML Virtual Reality Modeling Language. What Are We Going to See? What is VRML? Syntax of the language Features Examples.
Chapter 2: Algorithm Discovery and Design
Creating Web Page Forms
Fundamentals of Python: From First Programs Through Data Structures
Fundamentals of Python: First Programs
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 3 – Object Definition in VRML.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
VRML - 1 Virtual Reality Modeling Language (VRML) Peter O’Grady.
10 Adding Interactivity to a Web Site Section 10.1 Define scripting Summarize interactivity design guidelines Identify scripting languages Compare common.
Programming & Scratch. Programming Learning to program is ultimately about learning to think logically and to approach problems methodically. The building.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
VRML Scene Graphs. Learning Objectives Understand the concept of a scene graph Understand how VRML defines transformations (translations, rotations, and.
History of VRML and Its Development Process. Learning Objectives Understand the history of VRML Understand the purpose and functions of VRML Learn how.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Mashups with X3D Earth Mike McCann (MBARI) Alan Hudson (Yumetech)
1 Virtual Reality Modeling Language (VRML97) ©Anthony Steed
CHAPTER TEN AUTHORING.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
Computer Graphics Group Script node Jiří Žára. Computer Graphics Group Contents 1.Script node 2.Motion generators 2Script node.
H3D API Training Part 2.1: X3D. Outline  Scene graphs  X3D – XML syntax  X3D components overview.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
111/16/ :14 UML Instance Transformation x y z x y z x y z x y z SRT Model Coordinates.
Virtual Reality Modeling Language 97. What’s VRML? Virtual Reality Modeling Language 2D/3D graphics Audio:.wav,.mid Video: MPEG-1 Interactivity: time-
111/22/ :40 UML VRML 2.0 Scene Graph Structure Group Transformation Shape Nodes.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
VRML Anthony Steed Department of Computer Science University College London ©Anthony Steed
X3D Extensible 3D (X3D) Part 1: Architecture and base components.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 2 – Basic VRML.
Summer Computing Workshop. Session 3 Conditional Branching  Conditional branching is used to alter the normal flow of execution depending on the value.
Intro to VRML Let’s build something! The source code examples in this tutorial WORK!
DESIGNING 3D WEB USING VRML Bob Hobbs Introduction to Virtual Reality and Simulation CE
Web3D Jyun-Ming Chen Fall Contents Definitions, components Examples Task breakdown Survey of available technologies Recommended platform Details.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 6 – Texture Maps.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 5 – Animation in VRML.
Section 10.1 Define scripting
DLP for Virtual Environments (I)
JavaScript, Sixth Edition
Chapter 5 Validating Form Data with JavaScript
MPEG-4 Binary Information for Scenes (BIFS)
Programming & Scratch.
Section 17.1 Section 17.2 Add an audio file using HTML
Department of Computer Science University College London
Introduction To Flowcharting
VIRTUAL REALITY IN ROBOTICS
Teaching slides Chapter 6.
Lecture 3. Virtual Worlds : Representation,Creation and Simulation
Presentation transcript:

Extensible 3D (X3D) Graphics Examples Don Brutzman Web3D 2007, Perugia Italy, 15 April 2007 Naval Postgraduate School Monterey California USA

Web3D 2007 Symposium Sunday-Thursday April 2007 University of Perugia, Umbria Italy Sponsored by ACM SIGGRAPH in cooperation with EuroGraphics and Web3D Consortium

Session 1: X3D Introduction X3D Software Development Kit (SDK) Installing X3D-Edit and Examples Installing Xj3D and an X3D Plugin History, Goals, Development, Capabilities Chapter 1: Technical Overview X3D for Web Authors, Don Brutzman and Leonard Daly, Morgan Kaufmann Publishers Current Working Groups and Activities

Session 2: X3D Examples Chapter 2: Geometry 1, Primitive Shapes Chapter 3: Grouping Chapter 4: Viewing and Navigation Chapter 5: Appearance, Materials, Textures Chapter 6: Geometry 2, Points Lines Polygons Chapter 7: Event Animation Chapter 8: User Interactivity

Session 3: X3D Examples Chapter 9: Event Utilities and Scripting Chapter 10: Geometry 3, Geometry2D Chapter 11: Lighting and Environment Chapter 12: Environment Sensors Chapter 13: Geometry 4, Triangles Chapter 14: Prototypes Chapter 15: Metadata (online only)

Session 4: Scene Access Interface (SAI) Alan Hudson, Yumetech Installing Xj3D Examples directory Running in Netbeans

X3D Examples Chapter by chapter, from X3D for Web Authors

Chapter 1: Technical Overview When we mean to build, we first survey the plot, then draw the model. —William Shakespeare, Henry IV Part II Act 1 Scene 2 Chapter 1 is provided online.

Chapter 2: Geometry 1, Primitive Shapes Dorothy in Oz: “Toto, I’ve a feeling we’re not in Kansas anymore.” —L. Frank Baum, Wizard of Oz, 1939 Box Cone Cylinder Sphere Text

Geometry Primitives Primitives are simple geometric constructs Shape, geometry, Appearance, Material pattern Browsers decide implementation details, including tessellation resolution

Chapter 2: Geometry 1, Primitive Shapes

X3D Specification Diagrams

Chapter 3: Grouping A Working Group is a technical committee that researches and proposes solutions to specific technical problems relating to X3D. —Web3D Consortium Inline Group StaticGroup LOD (level of detail) Switch Transform

Coordinate Systems Right hand rule for X Y Z order Y axis is up Correspondence: North, Up, East Accept no substitutes! or at least realign them

Right-hand rule rules! First three fingers of right hand must align with the X Y Z axes, in that order Right hand rule also provides direction of positive rotation about an axis

Transforming shapes

LOD.jpg Near view Far view Level of detail: LOD node Range array values are suggested transition distances containerField name is children, not level

Switch node selects among children Note whichChoice index starts at 0; -1 means none Child-node containerField name is children, not choice

Chapter 4: Viewing and Navigation But the eyes, though they are no sailors, will never be satisfied with any model, however fashionable, which does not answer all the requisitions of art. —Henry David Thoreau, 1849 Viewpoint NavigationInfo Anchor Billboard Collision

Viewpoints

Billboard

NavigationInfo avatarSize dimensions

Binding stack example timeline1 t 0. The initial loading of scene has first active and bound to the top of the binding stack. Other viewpoints are off the binding stack. If no viewpoints are provided in the scene, then the default defined in the X3D Specification is used. t 1. When the user selects View2 from the viewpoint list, it receives a set_bind true event and goes to the top of the binding stack. View2 also issues an isBound true event, and View1 issues an isBound false event as it moves down the stack. t 2. Similar to the previous transitions in step t1, View3 receives a set_bind="true" event and responds with an isBound true event, while View2 issues an isBound false event and pushes View1 further down the stack. t 3. View3 receives a set_bind false event, triggering a corresponding isBound false event and dropping off the stack completely. Because View2 is the next node on the binding stack, it pops to the top to become the active Viewpoint node. View2 also issues an isBound true event.

Binding stack example timeline2 t 4. The user now selects View1 from the browser’s viewpoint list, so View1 receives a set_bind true event and sends a corresponding isBound true event. View2 is no longer bound, and is pushed down the binding stack. t 5. If View2 receives a set_bind false event while on the binding stack but unbound, and as a result, it is taken completely off the binding stack. t 6. View1 is now removed off the binding stack via a set_bind false event, leaving no other defined Viewpoint nodes on the stack. t 7. With no Viewpoint nodes remaining on the stack to bind, default viewpoint values are used:. The user then selects the previously unbound View4 from the viewpoint list. t 8. View4 remains as the bound viewpoint with no further viewpoints remaining on the stack.

Binding stack example timeline3

Chapter 5: Appearance, Materials, Textures Things are not always as they appear. Appearance Material ImageTexture MovieTexture PixelTexture TextureTransform

Chapter 6: Geometry 2, Points Lines Polygons Drawing is a struggle between nature and the artist, in which the better the artist understands the intentions of nature, the more easily he will triumph over it. For him it is not a question of copying, but of interpreting in a simpler and more luminous language. —Charles Baudelaire, On the Ideal and the Model, 1846 Color ColorRGBA Coordinate CoordinateDouble PointSet LineSet IndexedLineSet IndexedFaceSet ElevationGrid Extrusion

Convex and concave polygons Mnemonic: concave polygons have a cavity

colorPerVertex examples

LineSet, IndexedLineSet, IndexedPointSet

ElevationGrid nonplanar quadrilaterals Ambiguous definition is unavoidable for this geometric representation Usually not a problem; either masked or minor

Extrusion SCP: spine-aligned cross-section plane

Extrusions with crossSection visible

Extrusion

Chapter 7: Event Animation If it ain’t moving, it ain’t 3D. —Andy van Dam, SIGGRAPH pioneer, Brown University, Providence Rhode Island TimeSensor ScalarInterpolator ColorInterpolator PositionInterpolator PositionInterpolator2D OrientationInterpolator NormalInterpolator CoordinateInterpolator CoordinateInterpolator2D

Event, behavior, ROUTE defined Event = time-stamped value going over a ROUTE Behavior = changing a field value in a node ROUTE connection enables the output field of one node to stimulate input field of another node Field type and accessType must both match

X3D simple types, default values1 SFBoolSingle-Field boolean value false (XML) FALSE (VRML) MFBoolMultiple-Field boolean arrayEmpty list SFColorSingle-Field color, RGB0 0 0 MFColorMultiple-Field color array RGBEmpty list SFColorRGBASingle-Field color, RGBA0 0 MFColorRGBAMultiple-Field color array RGBEmpty list

X3D simple types, default values2 SFInt32Single-Field 32-bit integer value0 MFInt32Multiple-Field 32-bit integer arrayEmpty list SFFloatSingle-Field single-precision float0.0 MFFloatMultiple-Field single-precision arrayEmpty list SFDoubleSingle-Field double-precision float0.0 MFDoubleMultiple-Field double-precision arrayEmpty list

X3D simple types, default values3 SFRotationSingle-Field rotation axis-angle value MFRotationMultiple-Field rotation axis-angle arrayEmpty list SFStringSingle-Field string value Empty string ̎̎ ̎ MFStringMultiple-Field string arrayEmpty list SFTimeSingle-Field time value -1 sentinel (no time) MFTimeMultiple-Field time arrayEmpty list

X3D simple types, default values4 SFVec2f/SFVec2d Single-Field vector of 2-float/2-double values 0 MFVec2f/MFVec2d Multiple-Field vector array of 2-float/2-double values Empty list SFVec3f/SFVec3d Single-Field vector of 3-float/3-double values MFVec3f/MFVec3d Multiple-Field vector array of 3-float/3-double values Empty list

accessType values X3DVRML97 inputOnlyeventIn outputOnlyeventOut initializeOnlyfield inputOutputexposedField

TimeSensor Output time is an SFTime ramp function ranging [0,1] that repeats every cycleInterval seconds

Designing animation chains X3D can be imposing, there are many nodes Nevertheless a simple design pattern is used for nearly every kind of animation This event ROUTE pattern enables you to expertly animate most X3D scene behaviors

10-step design of animation chains,1 1. Pick target. Pick node and target field to animate (i.e., field that receives changing animation values). 2. Name target. Provide a DEF label for the node of interest, giving it a name. 3. Check animation type. Determine if the target field is a floating-point type: SFFloat, SFVec3f, MFVec3f, SFColor, and so on. The target field is either singleton SF type or array MF type. In the X3D type-naming convention, SF means Single Field, and MF means Multiple Field. Check target field accessType is inputOnly or inputOutput.

10-step design of animation chains,2 4. Determine whether Sequencer or Script. If the target type is an SFBool or SFInt32, use a sequencer node as event source. If the target type is an SFNode or MFNode, use a Script node as the event source. 5. Determine if Interpolator. If you are not using a sequencer or Script node, determine corresponding Interpolator which produces that type of value_changed output. Example: PositionInterpolator produces SFVec3f value_changed events.

10-step design of animation chains,3 6. Triggering sensor. If desired, add a sensor node at the beginning of the chain to provide the appropriate SFTime or SFBool triggering input to start the animation. Sometimes the triggering event is an output from another animation chain. 7. TimeSensor clock. Add a TimeSensor as the animation clock, then set its cycleInterval field to the desired duration interval of animation. Set loop='false' if an animation only runs once at certain specific times. Set loop='true' if it loops repeatedly.

10-step design of animation chains,4 8. Connect trigger. ROUTE sensor or trigger node’s output field to the TimeSensor input in order to start the animation chain. 9. Connect clock. ROUTE the TimeSensor fraction_changed field to the interpolator (or sequencer) node's set_fraction field in order to drive the animation chain. 10. Connect animation output. ROUTE the interpolator, sequencer, or Script node's value_changed field to target node, field of interest in order to complete the animation chain.

Hello X3D Authors showing ROUTEs

Hello X3D Authors 10-step process

Interpolation Interpolation is linear averaging applied 2 ways: first across time axis, then across value axis

Linear Interpolation Piecewise-linear curve fitting can approximate any curve with arbitrary accuracy Multi-field (MF) values are individually interpolated proportionately key=' ' keyValue='1 0 0, 0 1 0, 0 0 1, 1 0 0'

Linear Interpolation Step functions are created by repeating time values key=' ' keyValue=' ' Note that time-fraction key array must always be monotonically increasing

ColorInterpolator example

ColorInterpolator scene graph

ColorInterpolator scene graph with ROUTEs

ColorInterpolator html pretty-print

Chapter 8: User Interactivity Nobody knows the kind of trouble we’re in. Nobody seems to think it all might happen again. —Gram Parson, One Hundred Years from Now TouchSensor PlaneSensor CylinderSensor SphereSensor KeySensor StringSensor

Use the description field The description field allows the author to provide guidance text for each Sensor node This is a great way to tell users what is happening in the scene, and what they should do to interact effectively “Short and sweet” descriptions are best

CylinderSensor design pattern

CylinderSensor diskAngle mode determination

Chapter 9: Event Utilities and Scripting Action is eloquence. —William Shakespeare, Coriolanus, Act III, Scene II BooleanFilter BooleanToggle BooleanSequencer BooleanTrigger IntegerSequencer IntegerTrigger Script

Boolean, IntegerSequencer event timelines

IntegerSequencer event timeline

Script nodes Script nodes are used to create special-purpose animation and computation capabilities. Only create a Script when no other X3D node can get the job done Script code can be written either in ECMAScript (also known as JavaScript) or Java Future work: bindings for C++

X3D Execution Model

Script life cycle

examples/Basic/course/ CreateVrmlFromStringRandomBoxes.x3d scene graph

ECMAScript source code <![CDATA[ ecmascript: function R () { return Math.random(); } function recompute (isActive) { if (isActive==true) initialize(); } function initialize() { for (i=0; i < 10; i++) { rand1 = 100*R(); rand2 = 100*R(); rand3 = 20*R(); rand4 = 40*R(); rand5 = 20*R(); sceneString = 'Transform { \n' + ' translation ' + rand1 + ' 0 ' + rand2 + ' children [ \n' + ' Shape { \n' + ' appearance Appearance { \n' + ' material Material { \n' + ' diffuseColor ' + R() + ' ' + R() + ' ' + R() + '\n' + ' } \n' + ' geometry Box { \n' + ' size ' + rand3 + ' ' + rand4 + ' ' + rand5 + '\n' + ' } \n' + ' ] \n' + '} \n' + '#########################################################\n'; Browser.print (sceneString); newNode = Browser.createVrmlFromString(sceneString); // newNode = Browser.createX3dFromString(sceneString); ModifiableExternalNode.children[i] = newNode[0]; } ]]>

10 random boxes snapshot

Chapter 10: Geometry 3, Geometry2D Theorem. For a triangle with a right-angle between sides a and b, with hypotenuse c, a 2 + b 2 = c 2 —Pythagoras Arc2D ArcClose2D Circle2D Disk2D Polyline2D Polypoint2D Rectangle2D TriangleSet2D

Arc2D, ArcClose2D

Chapter 11: Lighting and Environment Daylight encourages good behavior. —Don Brutzman DirectionalLight PointLight SpotLight Background TextureBackground Fog

Light, object, viewpoint relationships

DirectionalLight

PointLight

SpotLight

Chapter 12: Environment Sensors Hereafter, when they come to model heav’n And calculate the stars, how they will wield The mighty frame, how build, unbuild, contrive To save appearances, how gird the sphere With centric and eccentric scribbled o’er, Cycle and epicycle, orb in orb. —John Milton, Paradise Lost, 1667 LoadSensor ProximitySensor VisibilitySensor Sound AudioClip

LoadSensor LoadSensor keeps track of progress and completion when downloading external file resources. LoadSensor can be used as a triggering node in event-animation chains. This capability lets authors carefully delay the commencement of scene animations by waiting until relevant image textures, sounds, and X3D files are properly loaded before commencing an animation sequence.

LoadSensor tooltip page

Sound ellipses and attenuation

Sound ellipse major, minor axes

Min, maxHalfWidth derivations helpful for Sound authoring

Stereo pan calculations for sound

Chapter 13: Geometry 4, Triangles and Quadrilaterals There is no “royal road” to geometry. —Euclid, to King Ptolemy I Normal TriangleSet TriangleStripSet TriangleFanSet QuadSet IndexedTriangleSet IndexedTriangleStripSet IndexedTriangleFanSet IndexedQuadSet

Normal calculations

Chapter 14: Prototypes There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy. —William Shakespeare, Hamlet Act I Scene V ProtoDeclare (ProtoInterface, ProtoBody) ExternProtoDeclare ProtoInstance

Prototype Declaration hints Follow X3D naming conventions for node and field definitions. Provide useful/safe default initialization values for each field, rather than depending on default field values internal to the ProtoBody. Include annotation tooltips for each field. Avoid copying ProtoDeclare definitions into additional scenes, instead copy ExternProtoDeclare and ProtoInstance definitions.

ExternProtoDeclare hints Don’t wrap ProtoInterface around fields, that’s illegal. For important prototypes, make a separate NewNodeExample.x3d scene that provides copyable ExternProtoDeclare/ProtoInstance definitions corresponding to the NewNodePrototype.x3d scene. This lets authors avoid copying the ProtoDeclare definitions, so that a master version remains stable and improvable. Do not include initialization values in field definitions. They are illegal since the defaults in the original ProtoDeclare field declarations take precedence. Copy annotation tooltips from corresponding ProtoDeclare tooltips.

ProtoInstance hints Explicitly include initialization values, even if they match default values, to ensure proper operation. Sometimes a prototype has different initialization values than expected, if modified elsewhere. Remember to include proper containerField attribute, identifying parent-node field name for this ProtoInstance. Default value: children. Example values: color, coord, geometry, fontStyle, proxy, sound, texture, textureTransform. First debug proper ProtoInstance operation in the scene defining the original ProtoDeclare, rather than using ExternProtoDeclare. Why – make sure it works first! Browser debugging can be more cryptic for externally defined prototypes and different versions may occur in various remote url addresses, making it difficult to determine precisely which ExternProtoDeclare is being referenced.

Chapter 15: Metadata (online only) Metadata defined: in general, "data about data;" functionally, "structured data about data." Metadata includes data associated with either an information system or an information object for purposes of description, administration, legal requirements, technical functionality, use and usage, and preservation. --Dublin Core Metadata Initiative (DCMI) WorldInfo MetadataInteger MetadataFloat MetadataDouble MetadataString MetadataSet Chapter 15 will be provided online.

Conclusions and Recommendations X3D is a cool language. Authoring can be fun! Many resources, tools and examples are now available, more than ever before. Lots of important work remains. You can help. Together we are building the 3D Web.

Don Brutzman Code USW/Br, Naval Postgraduate School Monterey California USA voice fax Contact