This is the workflow that I’m using to export Blender assets to Godot scenes for Dogrun.
I’m developing on linux and these are the relevant software that I’m using at time of writing:
- Blender 2.83.5 (deb)
- Godot 3.2.3 (flatpak)
- godot-blender-exporter (commit 3e66e12)
wget https://github.com/godotengine/godot-blender-exporter/archive/master.zip unzip master.zip mv godot-blender-exporter-master/io_scene_godot/ ~/.config/blender/2.83/scripts/addons/
Then in blender
Edit > Preferences > Add-ons and check
Import-Export: Godot Engine Exporter.
Preparing for export
You will get an error like:
Tangent space can only be computed for tris/quads, aborting if you attempt to
export a mesh with a face that has more than 4 verticies.
Find and fix this by entering
Edit Mode then
Select > Select All by Trait > Faces by Sides.
Greater than 4 verticies.
Now that the offending faces are selected, click
Faces > Triangulate Faces
and this will split our n-gon faces into triangles.
https://blender.stackexchange.com/a/55608 has a nice complete explanation about fixing these issues in general.
Before exporting you need to limit number of weights per vertex to 4.
Weight Paint mode and select
Weights > Limit total then enter
If you are using modifiers you actually need to run this after the modifiers are applied.
While the export plugin has an option to “Apply Modifiers”, the weights after applying the modifiers may exceed 4. Apply the modifier yourself then limit weights before exporting.
Armatures and Animations
I build the animations for my dog model by creating multiple “poses” and adding
them to the
Pose Library. Then in the
Action Editor I created a number of
animations that I then “stash” as a “non-contributing strip for later use”.
I get the cleanest exports by ensuring that I only have animations in the “Action Stash”.
Go to the
Nonlinear Animation editor in the Animation Workspace to verify that
all animations are in the “Action Stash”.
Here we see that the
beg animation is active and not in the stash.
We fix that by returning to the
Action Editor and pressing the
Returning the to
Nonlinear Animation editor I now clear out all actions other
than the stashed actions.
Select strips and delete them:
Then delete NLA tracks and
Remove Empty Animation Data.
The result is a clean rig with each animation in its own track:
See https://www.youtube.com/watch?v=weMes839wlc for more information on NLA and Actions.
I use these settings to export the character.
When importing I want:
- The material to be its own file - this is useful to re-use materials across models.
- The mesh to be its own file - this is helpful when a node nees to reference
the mesh directly (like a
- The scene to have a rig with a child
Actionis its own track. I use “built-in” storage here as I haven’t found separate files to be of much help (although adding animations does require re-importing).
I’ve found that the
Import with separate Objects and Materials preset to be a
good starting point:
So that is my current process! Hopefully this helps others looking to use Blender and Godot or at least help me remember later!
Be sure to check back here or follow me on twitter @tam7t to get the latest on Dogrun progress!