Both Blender and Godot are open source applications that are easily accessible to anyone around the world. Blender is a 3D modeling suite and Godot is a game engine. That means that you could use both of these applications for the purpose of designing your own video game. So how do we export game assets that we create using Blender and import them into Godot?
To export an object as a GLTF file, go to File > Export > glTF to bring up the file directory and the export settings. In the side panel, you have the parameters for the export. Set to export selected objects only and make sure the transform option is ticked for the +Y orientation. Then export to your project file for Godot.
The export process from Blender is similar to what it would be when exporting to any other game engine, you just need to tweak certain parameters to prep your model for the game engine of your choice. Godot is different in many ways from Unity and Unreal Engine and so we need to ensure that the parameters used for the export are correct, depending on the file format we use.
Preparing Your Model For Exporting
There are several steps that we need to take when preparing an object for export. Some of these steps may or may not be required depending on the purpose or file format, so we will list below the steps needed for all formats.
Scaling is one of the most critical aspects of game asset creation. A model that is too large or small may not fit appropriately in the game world, leading to unrealistic visuals or performance issues.
In Blender, you can check the dimensions of your game asset in the ‘Object Properties panel’. If the scale is off, you can adjust it using the ‘Scale’ tool in the ‘Transform’ panel.
Once the scale is set, it’s crucial to apply it. You can do this by selecting ‘Object’ > ‘Apply’ > ‘Scale’. This step ensures that the new scale becomes the object’s default scale.
Having too many unnecessary vertices and faces can cause performance issues in the game engine. Hence, it is essential to optimize your model’s geometry before export.
In ‘Edit Mode‘, select all vertices by pressing ‘A‘, then choose ‘Mesh‘ > ‘Clean Up‘ > ‘Merge By Distance‘ to remove duplicate vertices. You can also access merge options from the context menu (RMB) in edit mode and by pressing the ‘M‘ key
If your model has too many polygons, use the ‘Decimate‘ modifier to reduce the count. Remember to apply the modifier before export. Keep in mind that while this will reduce your geometry it will also affect your topology. Best used for static objects.
Also ensure that your object has correct normals, which determine if the asset can be displayed in the game engine from either outside or inside.
To correct normals, select your geometry in edit mode and press Alt + N to open the normals menu and choose the ‘Recalculate Outside‘ if viewing from the outside.
Materials And Textures
Materials and textures give your game asset its visual appeal. Ensure they’re correctly set up for a seamless transition to the game engine.
Make sure your asset has materials assigned. In ‘Material Properties‘, you can add new materials or assign existing ones to selected faces.
UV mapping is essential for accurately applying textures. In ‘Edit Mode‘, select all faces and choose ‘UV’ > ‘Unwrap’ to create a UV map.
If your textures are external files, ensure they’re correctly linked. You can check and fix any broken paths in the ‘File’ > ‘External Data’ menu.
Modifiers can significantly enhance your game asset, but they should be applied before export to ensure their effects are preserved.
In the ‘Modifier Properties‘ panel, apply each active modifier by clicking the ‘Apply‘ button.
Choosing The Correct File Format
Different game engines prefer different file formats for their imported assets. Choosing the correct file format is important because different formats allow the user to transfer different types of data and use specific parameters to define how the data will be exported/imported.
More popular game engines such as Unity and Unreal Engine will prefer the use of more commonly used universal formats such as the FBX and OBJ file formats.
For Godot however, the two file formats of choice are the glTF and Collada format types, which are better suited to the Godot pipeline. You can also use the FBX and OBJ options for Godot, but these don’t offer as much control or flexibility as the glTF format in particular.
There is also a better Collada file format that you download as an add-on for Blender, which improves the functionality of the base Collada format.
Ultimately it comes down to the purpose of the asset in your scene. If you are only importing a single static mesh to act as a background object then the OBJ format will do the trick.
But for adding additional data like materials and animations while being able to use them instantly in your scene then the glTF is the way to go.
Exporting As An GLTF File
While you may be unfamiliar with the format, the glTF file type is the primary option for importing 3D models into your Godot scenes.
To export your model using the glTF file format, go to File > Export > glTF to bring up the file directory and the export parameters. If you do not see the export option go to Edit > Preferences > Addons and type gltf in the search bar, then enable to addon for using gltfs with Blender, and repeat the above.
If you do not see the parameters for your export in the file browser that pops up for your export, press the N key on your keyboard to make the side panel visible. The first parameter that you can change is the format, where you can choose between three methods of data packing for your export.
The binary option keeps things clean on the export, packing all of the information into the glTF file. You will notice that the file extension here is not gltf but glb, where the b stands for binary.
The second option is the embedded method which uses the gltf extension for the file. The main difference between the two is that glb is more efficient for data exporting but gltf is easier to edit later on. We recommend starting out with the glb format as it is the simplest to work with.
The third option is the separated method that breaks up the exported data into three separate files. The main geometry data is stored in the gltf file, the binary data is stored in the bin file and the texture data is stored in the png or jpeg format.
Below that we can choose to remember the settings that we use for this export by clicking the checkbox. This will then use the same settings if we export multiple times in the same project,
You will also find a series of tabs that divide up the main parameters of the export such as the orientation of the object.
Under the ‘include’ tab, we recommend ticking the box that limits the export to selected objects only if you have a larger scene with objects that you do not want to export. The other options here we tend to leave blank in most cases, as our game engine will have its own light and camera objects.
In the transform tab, there is a single option that allows you to change the orientation of the objects so that +Y becomes the upwards direction. It is important to have this ticked because in Blender +Z is considered up, so changing this helps ensure that the model will be orientated based on Godot’s coordinate system and not Blenders.
The next tab allows you to edit how the geometry settings of your objects and if you want to export your textures and materials. The one option that you may want to enable is to apply the modifiers that you have with your objects, such as the subdivision surface modifier. Not doing so can result in a different appearance when importing to Godot.
The other options should be kept as they are unless you are looking to create materials in Godot, for which you would change the materials option from export to no export.
Finally, you have the parameters for animation data. Turn these off if you are dealing with static meshes, otherwise, keep them as they are.
Once you are ready with the parameters, define an easy to reach location to export your file to, such as the desktop, and then click on the export button. you can also locate the project folder for your Godot file and export it directly into that folder.
Note: If you see a folder inside your project folder named ‘.import’, don’t open that folder, as you are saving it in the main project folder itself. This is the method that we will use for our example.
When in Godot itself, you should see two new files appear in the res folder of the file system, provided you have exported a single model. The first should be the 3D object as a glb file, and the second is the material data which has the file extension of ‘.material’.
While the two files seem to be imported separately, adding the glb file to your scene will also add the material as well to that object. But you can also then assign the material to other objects if you want, by going into the inspector for an object, selecting the material tab, and then load your new material onto the object.
Exporting As An COLLADA File
An alternative to using the glTF file format is to use Collada, which is a popular option for transferring 3D assets across many different applications.
If you want to export your file as a Collada or ‘.dae’ file type, go to File > Export > Collada (.dae) and assign the parameters that you want for your export. Then define the location of your export, ideally the project folder, and click on the export button.
For the parameters tick the selected only box if you want to control which of the objects in your scene that you want to export over to Gogot. Also, set the orientation to +Y as the up direction and +Z as the forward direction.
If you have an armature, go to the armature settings and click on the deform bones only option.
For animations, you will normally want to keep the settings as is, but if you don’t have animation data to export, then untick the boxes.
When all the settings are made select the folder for your project to export the model and click on the export COLLADA button.
Then go to the Godot project and the file should be imported automatically. Double click on the file name in the file system if you want to create a new instance of that object so you can edit it in your scene. Or click and drag to add it to your existing scene.
Exporting As An FBX File
You can also export your model as an FBX if you wish, as this is the standard choice for most game engines. With Godot, the glTF format allows for more control when importing into Godot as setting up the scene, in general, is a bit different.
If you want to export your model in the FBX format, go to File > Export > FBX to bring up the file directory and the export settings. Then choose the correct parameters for the export. Next, select the location that you want to send the export to, which should be the project folder, and click on the export button.
With the parameters for the FBX format, there are a couple of changes that we need to make, the most important of which is the orientation, which should be set to +Y as the Up direction and +Z as the forward direction.
You should also tick the box labeled apply transforms to make certain that the location, rotation, and scale will be the correct values.
As with the other options, you may wish to check the selected objects only option to avoid exporting unwanted objects such as the lighting and cameras.
Choose the location for the export, which again should be the project folder for Godot. Click the Export FBX button to complete the process.
In Godot, the file will load automatically into your file system. Add the object to your scene as you would the other file types.
Creating A Preset For Your Exports
A handy tip when exporting files from Blender is to create your own designated file formats. This allows you to save the settings needed to export a specific object type to a certain application. For example, you can create the settings for exporting a glTF file to Godot, and then save that as a preset, so you don’t have to memorize or reenter those settings the next time you want to export to Godot.
As we just mentioned, you first need to choose what file format that you want to use for your export, lets take the glTF format for example.
Go through the process of locating and selecting your file format of choice to bring up the file directory and the export parameters.
Change the settings to exactly what you need for your preset, with this format the only change that you may want to make is the limit to selected objects option if there are objects that you do not wish to export. Most other parameters will be good as they are but click on the apply modifiers option and turn off the animation parameters as we don’t need them.
Before you click on that export button go to the top of these settings where you have the drop down menu labeled as ‘operator presets’. Click on the plus button to the side to add your current settings as a new preset. You will be prompted to give it a name, so call the preset Godot static, as it represents static meshes that we want to export to Godot.
You now have an export preset that you can use for all of your projects in your current build of Blender. Consider adding a second preset for meshed that will be animated.
Troubleshooting Issues With Your Exports
There are always going to be things that can go wrong when you are trying to send data from one application to another, and they may not always be immediately obvious to you.
Transferring data is a two-step process, both the export of the model from Blender and the import to Godot, and issues can appear in both steps.
Let’s take a look at the most likely issues you will face and how to fix these issues.
This is the most common issue when transferring models from Blender to a game engine like Godot. when importing a model you may find that the location, rotation, and/or scale of the model are different from what was assigned to them in Blender.
The cause here actually originates from Blender itself and not with Godot. When you edit an objects’ transforms in object mode these transforms are calculated based on the object’s original default values for each transform. This means that if you set your scale to three on all axis in Blender, then it is three times its default size.
Import a model in this state in Godot, and you will likely find that the size is only one third of what it should be because it is trying to import based on those original values.
The fix here is incredibly simple, just go into your Blender project and select your object, then press the hotkey combination of ‘control + A’ to bring up the apply menu in your 3D viewport. You have a variety of options here, but you will want to choose either the ‘All transforms’ or ‘Rotation and Scale’ options depending on whether or not you want to revert your location.
If exporting a single mesh, you will want to position the object at 0,0,0 in Blender anyway so you don’t have to apply the location transform.
However, if you are looking to export an entire scene exactly how it is then you may want to apply all of the transforms for every object in your scene.
Once you have applied the correct transforms you should be able to export again and then reimport to Godot with the correct transform values.
When you bring your model into the Godot engine, it may be facing the wrong way, or it may be lying down on its side. This is normally a result of choosing the wrong settings for the export orientation, which is easy to do with the Collada export in particular because its default settings match Blender and not Godot.
This should not be the case with the glTF format since the option to orientate the object correctly is enabled by default, but make sure to check the settings regardless.
If the orientation is still not correct on import the transforms may not be correct in Blender (See Above) or you may have in fact modeled the object on a different axis. In this case, just rotate your model so that it is facing forward in Blender and apply the rotation, then export with the correct orientation assigned.
Cannot See The Faces Of The Model
Vertices have an inward direction and an outward direction, to indicate which direction represents the ‘front’. A face’s inward and outward direction is defined by the vertices used to construct it. The direction of the outward facing side can be drawn as a line perpendicular to the surface and this is referred to as a normal.
Why is this important? Well in game engines only the outward facing side is made visible while the inward facing side is not rendered at all, a process known as backface culling. This is why you sometimes export your model to game engines and find that some of the faces are invisible, because the normals are the wrong way round and what should be the outward face is actually the inward face.
To fix the issue in Blender, select the entire model in edit and press the hotkey combo ‘Shift + N’ to recalculate all the normals so that they are facing outwards. If that does not work, or the result simply reverses the faces that are visible, go back to Blender and select the faces that need to be flipped.
Next, use the hotkey ‘Alt + N‘ to bring up the normals menu and select the flip option. This should reverse the selected faces.
Do You Need To Learn Coding To Use Blender?
In the early days of 3D modeling coding was an important skill to learn if you wanted to even create basic shapes as you had to program your computer directly
What is Blender Used For? A List Of Reasons To Use Blender….
Blender is a free open-source program provided by the Blender foundation. It is one of the fastest developing 3D toolkits currently available and also one of the fastest growing online
Is Blender Safe To Download Or Is It A Virus?
You may have heard about this wonderful thing called Blender 3D that can perform all sorts of tasks from modelling 3D sculptures to editing full video files, and all for
How To Change My Unit Measurements In Blender?
3D modeling applications can be used to create accurate representations of real-world objects. But for them to be truly accurate, the models need to be using the correct values for