Basic Examples
The following are a few examples illustrating some basic features of the X3D format. It is useful to compare the source code of the X3D files with the comments given. All of these examples are available in both VRML and X3D formats.
Basic 1 Pencil

This simple pencil is made of two shapes, a cone and a cylinder. The shapes are positioned by placing them in Transform nodes. The translation fields of these nodes are then set to appropriate values. The colors are applied by adding Appearance and Material nodes to the Shape nodes and then adjusting the values of the diffuse color field in the Material nodes.
The file for this and other examples can be found in the download package for SwirlX3D.
Basic 2 Traffic Light

This example shows how animation can be incorporated into an X3D file. The key elements are a TimeSensor node, ColorInterpolator nodes and Routes connecting them to the colors of the three lights. Time (fraction) messages are sent from the TimeSensor to the ColorInterpolators, which calculate the colors for that time and then send these colors to the diffuse color fields of the Material nodes for each light. Note in the source code how the key values of the ColorInterpolator nodes are adjusted for the length and timing of each light.
Basic 3 Steam Engine

This example shows how PositionInterpolator and OrientationInterpolator nodes can be used to add motion to machinery. A PositionInterpolator node moves the pink rod back and forth. PositionInterpolator and OrientationInterpolator nodes translate and rotate the blue bars. An OrientationInterpolator node rotates the large wheel.
Also, the second blue bar is cloned from the first blue bar using the USE command from VRML.
Basic 4 Toy Train

This example shows some of the ways that several files can be used in a single scene. The track is imported into the scene from track.wrl using an Inline node. The wagon is defined as a Proto (user-defined node) in a file called wagon.wrl. This node type is then brought into the scene using the ExternProto mechanism. Two instances of this ExternProto are then created and they are moved about using Interpolator nodes.
The sides of the wagons and the tracks illustrate uses of texture files. The tracks are formed by an Extrusion node whose spine is a large circle.
Download X3D and Vrml Files