An efficient, modern format, developed by Khronos. Resources:
Supported features of glTF models in our engine:
Meshes (polygons, lines), transformation hierarchy.
Materials (with physically-based or unlit shading, internally implemented using new X3D 4.0 material nodes explicitly designed for straightforward glTF compatibility), alpha mode, double-sidedness, per-vertex colors.
Texturing (for base color, normal maps, emissive, material-roughness).
Animating transformations (position, rotation, scale) and using skin ("armature" in Blender). They can be played using standard CGE
PlayAnimation method (or other means, e.g. to play multiple animations from one model simultaneously).
Cameras (perspective and orthogonal). Camera transformations can be animated too.
Punctual lights (point, spot, directional lights).
.gltf extensions are supported. Textures can be provided in separate files or embedded inside the GLTF stream.
It is integrated in our engine as X3D nodes graph. This means that you can include a glTF model inside larger X3D file using the
Inline node, you can modify the glTF scene graph at runtime (e.g. modify material color, show/hide something etc.) and you can serialize the scene graph to an X3D file.
Collisions automatically work (as with all other scene formats), you only have to initialize Scene.Spatial (see the manual). By default, static meshes have precise collisions (treating them like a set of triangles), while skinned-animated meshes collide as simple bounding boxes (so they don't cause a slowdown when animating). This can be even customized per-shape by adjusting Shape.collision property.
We apply gamma correction automatically on PBR materials. You can request to apply it on all materials (including unlit) to follow glTF spec in 100% easily.
We read glTF "extras" data that can be defined by your authoring tool, for example in Blender this is defined by "Custom properties". This allows to pass any custom information from Blender to the engine, for use in your own applications, or to influence the import — see Custom properties in Blender.
TODO: Main missing feature is morph targets.
X3D and VRML is a flexible and powerful format for 3D models and a basis of our scene graph.
The following extensions are recognized:
X3D in classic and XML encoding:
VRML 1.0 and 2.0:
We have a great support for X3D and VRML, and handle rendering, animation, interaction, scripts, shaders and more features of these formats. An entire section of this website, Scene Graph (X3D), documents all the features we support (from the X3D and VRML standard, and many of our own extensions).
Note that X3D has a lot of features, and most exporters do not allow to configure everything possible in X3D.
But you can use
Inline node to include one file (X3D, glTF or any other that CGE can handle)
within another X3D file, and you can simply write some X3D content by hand.
That's good for adding scripts to 3D data, and generally adding
stuff that is uncomfortable (or impossible) to design in your 3D modeller.
See e.g. examples/fps_game/ game data for comments,
especially the level file
You can load animations as sprite sheets, defined using various formats:
Castle Game Engine format (extension
.castle-sprite-sheet), created by sprite sheet editor inside the CGE editor.
Starling (XML) format (traditionally with
.xml extension, in CGE we require you rename them to
Cocos2d format (traditionally with
.plist extension, in CGE we advise (but do not require yet) to use
See the sprite sheets documentation.
You can load image as a scene too. That is, you can load a simple PNG file using
TCastleScene.Load method. It will create a rectangle (which you can use as 3D or 2D object) using this image as a texture, with size adjusted to the image size. See the image loading documentation.
Castle Animation Frames
formerly known as
This is a simple format for animations, used to export animated models from Blender. It supports animating of everything in Blender (transformations, skin, shape keys, materials, particles, physics...), although it is somewhat memory-hungry.
Animation through a series of static models like
This is useful if you have files named like:
xxx001.obj xxx002.obj xxx003.obj ...
You can load such animation from a sequence of files using the URL
[email protected](3).obj. It's exactly how you can load a movie from a sequence of images. See demo-models/.../wavefront_obj_animation for an example, you would load them by
It's not an efficient way to store the animation in a file (or to load it). It is much better to export to X3D or glTF animation, if you can. But it may be useful when you have no other option to export.
Blender exporter to Wavefront OBJ with "Animation" checkbox generates such animation. Hint: uncheck "Write Normals" and check "Keep Vertex Order" in the exporting dialog box, to make sure models are "structurally equal" which allows CGE to merge the animation nicely (even produce more intermediate animation frames, if needed). This also means that CGE will recalculate normals by itself (unfortunately this isn't always desired, because Blender doesn't pass the creaseAngle information to CGE, so CGE cannot smooth the normals as in Blender -- it doesn't know when it should).
The animation is played and smoothed following the same logic as castle-anim-frames format. In a way, using URL
[email protected](4).obj is just a shortcut for creating a
xxx.castle-anim-frames file that would list the appropriate static frames using XML elements.
We support a lot of Collada features — geometry with materials,
textures, cameras, lights. Tested on many Collada examples,
like Collada Test Model Bank
and Collada models exported from various Blender
All modern Collada versions (1.3, 1.4, 1.5) are handled.
Animations in Collada files are not handled yet. If you need animations, we advise to use glTF instead. glTF is newer and has similar feature set. Khronos provides a converter from Collada to glTF.
1.0 ASCII files (
.iv extension) are handled.
Inventor 1.0 and VRML 1.0 are very similar
formats, we also handle some additional Inventor-specific nodes.
3d Studio 3DS format. We support most important things: meshes, cameras, materials, textures.
MD3. This is the format used for models
in Quake 3 and derivatives (Tremulous
etc.). Almost everything useful from MD3 file is supported:
geometry with texture (coordinates, and texture filename from
xxx_default.skin file), animation is also read
Wavefront OBJ files. We support most important things: geometry (with texture coords, normal vectors), materials (colors, opacity, texture filenames).
STL (Standard Triangle Language, aka STereoLithography). STL is a simple popular 3D format used in 3D printing. We support both ASCII and binary formats.
Very basic support for this very old 3D format.
Copyright Michalis Kamburelis and other Castle Game Engine developers.
Thank you to Paweł Wojciechowicz from Cat-astrophe Games for various graphics.
This documentation is also open-source and you can even redistribute it on open-source terms.