H3D API Training Part 2.1: X3D
Outline Scene graphs X3D – XML syntax X3D components overview
Scene Graph Group Transform Shape Box Shape Sphere“gold” children appearance geometry
Scene Graph The scene graph is a directed graph of nodes used to define and manage applications Hierarchical structure – children/parent. Each node affects its children.
What is a Node? ◦ A container for fields: ◦ Manages fields Allocation, deallocation of fields Initialisation of fields Manages internal (and external) routes ◦ Reusable modules of functionality ◦ Simplify application development
Nodes
X3D ISO standard for 3D content and interaction Backwards compatible with VRML
X3D - XML “XML encoding” of X3D Similar in appearance to HTML (technically a subset of XML) Basic structure: ◦ Header ◦ Statements (scene graph nodes, routes)
Example
XML Objects encoded begin with a “<name” and end with either ◦ “/>” for single entities ◦ “ ” for compound entities
Comments Comments are enclosed within
X3D – DEF/USE
X3D – DEF/USE example Reference an existing DEFined Node with the USE attribute Useful to avoid data duplication / redundancy ◦ Especially with appearances ◦ Any mesh geometry that is identical
X3D - ROUTE Dependencies between field are set up with routes:
Example DEF/USE/ROUTE
X3D - containerField Indicates the default field that a node should be assigned to ◦ e.g. “child” for Group, Transform, Shape ◦ “appearance” for Appearance ◦ “geometry” for IndexedFaceSet, Sphere containerField hidden from most X3D and H3D use, but necessary to know about
X3D Components
Grouping Component Group ◦ Basic grouping. Transform ◦ Specifies coordinate system transformation. Switch ◦ Choose one of many children.
Geometry Component Shape Appearance Geometry ◦ Box ◦ Cone ◦ Sphere ◦ IndexedFaceSet ◦ etc
Texturing Component ImageTexture ◦ MultiTexture ◦ PixelTexture ◦ (MovieTexture) TextureTransform TextureCoordinate
Interpolator Component Useful for basic animations: ◦ ColorInterpolator ◦ CoordinateInterpolator ◦ NormalInterpolator ◦ OrientationInterpolator ◦ PositionInterpolator
Text Component Text FontStyle
Lighting Component DirectionalLight PointLight SpotLight
Other Components Time RigidBodyPhysics Rendering Sound Device Sensors Navigation Programmable shaders Particle system
X3D Abstract Nodes X3D specification defines abstract nodes; ◦ Cannot be instantiated / used ◦ Contain common functionality used in certain types of nodes ◦ Nodes inherit from abstract nodes
X3D Abstract Nodes All X3D abstract nodes begin with “x3d” ◦ X3DNode ◦ X3DChildNode ◦ X3DGroupingNode ◦ X3DGeometryNode ◦ X3DLightNode ◦ etc
Interface objects X3D specifies a number of abstract interfaces. Specifies some functionality that a node should implement. Examples: X3DBoundedObject X3DUrlObject H3DDisplayListObject
H3DLoad and H3DViewer Settings via H3DLoadSettings program H3DLoad – console H3DViewer – window application ◦ Settings for changing different options on the fly.