Documentation
Documentation
Scroll down to Using the Addon to see specifics on the functionality.
Overview
This add-on works in the following way:
- Install the Blender Addon from this package (.zip file) in Blender
- Install the "Blender-Godot Pipeline" addon from the Godot AssetLib in your Godot project
- Use the addon to set custom properties to objects and meshes inside Blender. This creates "import instructions" for the GLTF file when it is imported into Godot
- Set up the Scene Import script, GLTFImporter.gd, on the Godot side*
- Export as a GLTF file OR save as a .blend file (new feature in v2.2)
- Drag GLTF or .blend file into your scene. This creates the original node (this has the link to the GLTF file import) and an _Imported node which contains all of the changes from the addon.
* see Set the Default Scene Importer in your Godot Project below
You're done!
This allows you to quickly re-iterate on your scene in Blender without having to do much manual work in Godot. The aim of the add-on is to reduce 3D workflow burden.
Setup in Blender
Find the zip file from the downloaded files, and inside Blender hit Edit -> Preferences -> Add-ons -> Install.
Then click the checkbox on the left of "Object: Godot Pipeline":
Exporting your Scene
As of version 1.2, the new "Export" button takes care of all of this for you. I have hand crafted a set of GLTF export properties from Blender that work really well with this pipeline workflow.
Alternatively, just use .blend file importing in Godot (save your blender file in Godot).
Drawbacks to using .blend File Importing
.blend file importing is very convenient, but it has two issues:
- You can't control the export options from Blender (like only export visible, for example)
- It tends to be slower, because Godot is calling blender's python API through the command line
Consider these trade-offs when using it.
Setup in Godot
Search for "Blender-Godot Pipeline" in the Asset Library, and download it:
Then the import files automatically come into your game:
Set the Default Scene Importer in your Godot Project
(Alternative Method) Attach the Importer to a GLTF File:
Find the GLTF file which you want to import, click on it, and then see the "Import" tab in the top left. Find the "GLTFImporter.gd" script and attach it.
When you reload the GLTF (you can re-trigger a reload by exporting from Blender or saving the .blend file), the import script will automatically run.
Drag into Scene
Once the import script has ran (you will see entries in the console), you can drag the GLTF file into your scene to create a Node3D:
At this point you should see all your collisions and custom properties set in the level_01_Imported node.
There is also a hidden node, with a script on it, called level_01 - this contains the original link to the GLTF file and allows hot reloading to work. Delete this node when you want to turn off hot reloading.
Using the Addon
Press the N key, and you will find the addon in Object mode:
Utilities Tab
Assign to Mesh
This allows you to apply settings (such as collision details) to a mesh rather than an object inside Blender. This can be great for instancing workflows where you use Alt+D to reproduce an object many times, while keeping the same mesh.
*Note: there is an error on the Blender side (not this pipeline), where the scale cannot be applied when an object is selected that has been duplicated via Linked Duplicates (in other words, another object uses the same mesh). This error goes away when you select all objects that use the same mesh, however, Blender still refuses to apply the scale. You can work around this by "Applying Scale" to those objects, as normal to those objects.
Use Material Slot
When this box is checked, you can copy in a material path from Godot into the name of a material slot in blender. Upon importing, the material referenced by the path will automatically get applied to the object:
Display Addon Data
Shows a popup with all of the currently set addon data.
Clear Addon Data
This will remove all addon data for the object (or the mesh, if "Assign to Mesh" is checked). Note that this will only remove custom data associated with this pipeline, and no other data.
Collisions Tab
This tab is one of the most commonly used features of the pipeline:
Collision
Options: Box, Cylinder, Sphere, Capsule, Trimesh (Concave), Simple (Convex), or None.
The Box, Cylinder, Sphere and Capsule shapes are "primitive" shapes. Their dimensions and origins will be automatically calculated when you press "Set Collisions".
Trimesh and Simple, are pass through instructions to Godot: upon importing, Godot will convert those meshes to the appropriate collision shape. Trimesh are typically used for terrain surfaces, and convex (or Convex Hull) collisions can be used for props and objects.
Note that primitive collisions are the most efficient and should be used where you can. A big part of this pipeline was trying to design a workflow that would be fast for authoring primitive collisions.
When you select "None", then the object will be imported with a Godot PhysicsBody, but no shape as a child node of it.
Body
Options: StaticBody3D, RigidBody3D, Area3D, AnimatableBody3D, CharacterBody3D, None
Note that AnimatableBody3D can be used, but AnimationPlayers do not re-parent properly in Godot (this is an engine level issue). So trying to set up a rigged, animated character body and have it come in as an AnimatableBody3D does not often work. I have a video describing some workaround
When you select "None", then the object will be imported in Godot without a Physics Body. This can be useful if you only want to create a collision shape, and then parent that shape to another body. This parenting can be done inside Blender, and will be respected upon importing into Godot.
Display Wireframe Bounds
This is a visual display option inside Blender that shows the wireframe on the object. This can be useful if you only want to use a mesh as a collision shape and need to see the extents of its bounds.
Discard Mesh
When checked, the mesh will be discarded upon importing into Godot (you won't get a MeshInstance3D node). This can be useful if you want to generate a shape by itself, or maybe a physics body with a collision shape child, but no mesh.
Collision Margin
This applies a margin on the auto-calculated primitive shape. For instance, if the shape is a box and Collision Margin is 1.10, then the length, width and height properties will be 10% larger than what is calculated inside Blender.
Apply Scale
Generally, this should be kept on. This ensures that objects inside blender have their scale applied. This tends to solve many strange issues that occur when trying to work collision shapes.
Preserve Origin
Generally, this should be kept on. This allows objects with origins that are not at the center of the object to be used as primitive collision shapes. The add-on takes car of all of the math needed to make this happen. It can be great for kits that have meshes with their origins at the bottom, for snapping and alignment,
Set Collisions
This button actually applies all of the above settings to the object (or mesh) in Blender. You need to press this button again every time you want to make changes to the collision properties of a mesh. This includes the situation where you set all the collision properties, then change the shape of a collider in the 3D viewport - in that case, you need to hit "Set Collisions" again to ensure the values are updated.
Path Setter Tab
The path setter tab provides a wide variety of functionality, and it operates based on one simple principle: you tag objects in Blender with certain "paths" of resources from Godot, and the importer will do special functions based on what type of path it is.
Path
This is the path copied from Godot - pick a resource in Godot, right-click and press "Copy Path", or press Ctrl+Shift+C, then paste it into the "Path" field in the addon.
Generally speaking, meshes should be .res files, materials should be .tres files, and shaders should be .gdshader files.
Path Type
Here are the options for Path Type:
Script
The script associated with the path will be attached to the node upon import. Note: when applying Collision settings, the script will be attached to the PhysicsBody3D (the parent object), not the MeshInstance3D.
Material 0, 1, 2, 3
Assign the material associated (slot 0, 1, 2 or 3) with the path to the MeshInstance3D. Note: when applying Collision settings, the material will be attached to the MeshInstance3D (not the parent PhysicsBody3D object).
Shader
This function is less useful, and considered legacy
The path is expected to be a .gdshader file, and will be applied to the mesh along with a ShaderMaterial. It is better to use the "Material" setter above, and save the ShaderMaterial as a resource on the Godot side.
Nav Mesh
Allows you to hand author a nav mesh in Blender. The path will be the location that the nav mesh is saved to.
Multimesh
Allows you to create a Godot multimesh in Blender. The path will be the location that the mesh is saved to.
Workflow hint: you can do a "lazy" duplication of objects in Blender, without considering instancing. In Blender these will all have separate meshes. You can optimize this by Shift+Selecting all of those objects, and assigning a Multimesh Path to them. Choose a new .res file (e.g. res://some_folder/multimesh_mesh.res), and then import. The pipeline will take care of the rest, generating a MultiMeshInstance3D, and saving the mesh resource.
Physics Material
This is meant to be used in combination with the Collision settings. When a PhysicsBody is selected, the physics material referenced with this path will be applied to the PhysicsBody node.
Parameter File
This option allows you to set custom parameters of a node upon import. For example, you could set collision layers and masks on a physics body object by attaching a parameter file as follows.
Path:
res://folder_to_param_file/some_physics_body_props.txt
Contents of some_physics_body_props.txt
collision_layer=1collision_mask=1|2
This would create a collision object with the following layers set:
Packed Scene
This allows you to use a greybox mesh in Blender, and have it replaced with a packed scene file in when importing into Godot.
String Setter Tab
This allows you to set properties of nodes, very similar to the "Parameter File" above.
For example, to set layers and masks on a collision body:
collision_layer=1;collision_mask=1|2
Export Tab
This tab allows you to tweak some settings on Export quickly. It is more convenient than finding Blender's default GLTF exporter.
Note that you can use Blender's GLTF exporter to customize more options if you need. You must ensure that Include -> Custom Properties is set.
File Path
Choose the file path to export to, typically somewhere in your Godot project. File name must end in .gltf
Apply Modifiers
Recommended On. Apply all modifiers prior to exporting.
Use NLA Tracks
By default the exporter will use "Action" animations, but you can switch to "NLA Tracks" if you need to.
Append Object Name
This can be useful if you are exporting multiple GLTF files from within one Blender file. It appends the Blender objects name to the filename
somefilename_MyBlenderObject.gltf
Individual Origins
This sets the position of each blender object to (0,0,0) upon importing into Godot. This means all the imported meshes or collision bodies will be imported at the location (0,0,0).
This can be useful for a variety of reasons, but mainly for "Individual Packed Resources".
Individual Packed Resources
This causes each object in Blender to get imported as its own packed resource upon importing into Blender. The filepath for the packed resources will be whatever folder the GLTF file is imported in, then inside a packed_resources/ folder.
Export for Godot
Final button to press to export everything to a GLTF file.
Get Blender To Godot 4 Pipeline Addon
Blender To Godot 4 Pipeline Addon
A Blender addon which provides many different tools for pipelining content into Godot 4.
Status | Released |
Category | Tool |
Author | michaeljared |
Tags | 3D, Atmospheric, Blender, Godot, Indie, No AI, pipeline |
More posts
- Frequently Asked Questions (FAQ)10 days ago
- The Pipeline is now on Itch!10 days ago
Leave a comment
Log in with itch.io to leave a comment.