910 likes | 1.04k Views
Extensible 3D (X3D) Graphics Examples. Don Brutzman Web3D 2007, Perugia Italy, 15 April 2007 Naval Postgraduate School Monterey California USA brutzman@nps.edu. Web3D 2007 Symposium. Sunday-Thursday 15-19 April 2007 University of Perugia, Umbria Italy
E N D
Extensible 3D (X3D) GraphicsExamples Don Brutzman Web3D 2007, Perugia Italy, 15 April 2007 Naval Postgraduate School Monterey California USA brutzman@nps.edu
Web3D 2007 Symposium • Sunday-Thursday 15-19 April 2007 • University of Perugia, Umbria Italy • Sponsored by ACM SIGGRAPH in cooperation with EuroGraphics and Web3D Consortium • http://www.web3D.org/web3d2007
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
Geometry Primitives • Primitives are simple geometric constructs • Shape, geometry, Appearance, Material pattern • Browsers decide implementation details, including tessellation resolution
Chapter 3: Grouping • A Working Group is a technical committee that researches and proposes solutions to specific technical problems relating to X3D. • —Web3D Consortium
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
LOD.jpg Far view Near view Level of detail: LOD node • Note that children index starts at 0, -1 means none • 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
Binding stack example timeline 1 • • t0. The initial loading of scene has first <Viewpoint DEF="View1"/> 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 <Viewpoint position="0 0 10"/> defined in the X3D Specification is used. • • t1. 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. • • t2. 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. • • t3. 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 timeline 2 • • t4. 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. • • t5. 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. • • t6. View1 is now removed off the binding stack via a • set_bind false event, leaving no other defined Viewpoint nodes on the stack. • • t7. With no Viewpoint nodes remaining on the stack to bind, default viewpoint values are used: • <Viewpoint position="0 0 10"/>. The user then selects the previously unbound View4 from the viewpoint list. • • t8. View4 remains as the bound viewpoint with no further viewpoints remaining on the stack.
Chapter 5: Appearance, Materials, Textures • Things are not always as they appear.
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
Convex and concave polygons • Mnemonic: concave polygons have a cavity
ElevationGrid nonplanar quadrilaterals • Ambiguous definition is unavoidable for this geometric representation • Usually not a problem; either masked or minor
Chapter 7: Event Animation • If it ain’t moving, it ain’t 3D. • —Andy van Dam, SIGGRAPH pioneer, • Brown University, Providence Rhode Island
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
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.
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='0 0.3333 0.666 1' • keyValue='1 0 0, 0 1 0, • 0 0 1, 1 0 0'