Exporting 3D Models made in Blender to the Godot Engine
As a quick demonstration of how to export 3D models from Blender to the Godot Engine, I have made a cereal box, inspired by a tutorial video that used a cereal box as an example of how to perform UV texturing, which we will come back to. The cereal box in question:
To export this mesh, I travelled into the File menu, and navigated into the Export options:
The option that I’ve chosen to export as is the glTF 2.0
option:
But why that option? Looking at the relevant Godot Engine documentation:
When dealing with 3D assets, Godot has a flexible and configurable importer.
Godot works with scenes. This means that the entire scene being worked on in your favorite 3D DCC will be transferred as close as possible.
Godot supports the following 3D scene file formats:
glTF 2.0 (recommended). Godot has full support for both text (.gltf) and binary (.glb) formats.
DAE (COLLADA), an older format that is fully supported.
OBJ (Wavefront) format + their MTL material files. This is also fully supported, but pretty limited (no support for pivots, skeletons, animations, PBR materials, …).
ESCN, a Godot-specific format that Blender can export with a plugin.
FBX, supported via the Open Asset Import library. However, FBX is proprietary, so we recommend using other formats listed above, if suitable for your workflow.
Some more info on what glTF is from a 2021 blog post on the Godot site:
glTF 2.0 (GL Transmission Format) is a fully open-source, widely implemented interchange format with built-in support for physically-based rendering standards. glTF is a growing 3D format and has received massive adoption in the game industry. Commonly selected as the format for new software and game engines, glTF can also have new functionality added using extensions.
glTF can be used in many diverse ways to import or export models across existing industry-standard tools, either through native glTF support or through third-party plugins.
Godot has had support for importing glTF 2.0 files since Godot 3.0, and we strongly expressed our support of this open format. This support has gradually improved over the years and is now quite mature, at the same time as exporters in software like Blender have also reached a very good state.
Continuing…
Looking at the export options, I can see that I have a couple of different formats I can export to:
For simplicity’s sake, I’m choosing the .glb
format, which, according to Blender:
Exports a single file, with all data packed in a binary form. Most efficient and portable, but more difficult to edit later.
At present time, I’m not entirely sure what I would be editing if I wanted to, but I assume that I may come across a situation that may need me to edit some data.
As a side note, I can also export all the data separately (JSON, binary data, and texture material).
I’m also make sure to include the select objects, which should only be my cereal box model at the moment:
Now that this data has been exported to my Godot project directory, I open the Godot Engine, and make a 3D Scene:
Our cereal box and it’s material have entered into our file tree:
A simple drag-’n-drop, and we have our model in our scene!
Now, with this in mind, how might we import a model with a texture? We’ll be tackling that once we’ve figured out how to perform UV texture unwrapping.