X3D (and it's older version, VRML) is a file format for 3D models. You will find that virtually any 3D modeling program can export to it, for example Blender includes an X3D exporter (see also our Blender exporting notes).
As a 3D file format, X3D is quite unique, as
It's not only a file format. It's actually a very flexible scene graph for 3D applications. Every X3D node corresponds to a Pascal class with appropriate fields, and you can freely create and modify X3D nodes at runtime.
It's designed to describe virtual 3D worlds, not just static scenes. So you can express animations, interactive behaviors (e.g. open the door when user presses a handle), and scripting right inside the X3D file. Many advanced graphic effects are also possible, like mirrors by generated cube map textures, screen effects, shadow maps, shadow volumes, effects using GLSL shaders and much more.
Note that our engine supports many other 3D and 2D file formats too, like glTF, Collada, Wavefront OBJ, Spine JSON... They are all loaded into a graph of X3D nodes. So X3D is our scene graph, but it's absolutely not the only file format that we support.
Learning X3D: Use this part of the documentation to learn about the available X3D nodes and their fields.
The nodes in the official X3D specification are divided into components. We list all the supported nodes, with links to their X3D specification. For some nodes, we also mention eventual caveats or simple extensions that we have implemented.
The unofficial nodes that we add documents some cool graphic effects available in our engine through special X3D nodes.
The X3D specifications are your ultimate resource to learn X3D. You will most likely want to browse X3D Architecture and base components specification, which describes the available X3D nodes. The nodes are grouped into components.
When we say that "X3D is our scene graph", what it means in practice is that you have a graph of X3D nodes inside the RootNode property of any TCastleScene instance. The TCastleScene is our central class to render and animate 3D and 2D content, see the manual about TCastleScene.
This way you can edit (or even build from scratch) a graph of X3D nodes using Pascal, to create any content you like. You are not limited to only loading the content from X3D files (or Collada, or Wavefront OBJ...).
For example, consider an X3D node
Box (this is a link to the X3D specification about it).
This node in X3D has fields
size (the X3D type is
solid (the X3D type is
In Pascal, this node corresponds to the class
Size (type TVector3) and
Solid (type Boolean).
You can create and edit instances of
TBoxNode and use
TCastleScene to render them.
This section of the Castle Game Engine documentation describes all X3D nodes (often by referring you to the X3D specification for details), and it shows various examples how to create and edit X3D graph using Pascal. See for example Pascal example of creating a 3D mesh (TIndexedFaceSetNode), or Pascal example of seting up 2D rectangle and lines.
Copyright Michalis Kamburelis and others. Particular thanks go to Paweł Wojciechowicz from Cat-astrophe Games for various graphics. Even this documentation is open-source and you can redistribute it on open-source terms, in particular CC BY-SA.