FBX export fails with some very simple material setups #41396
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#41396
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Win7 Home premium 64 SP1, i7, Nvidia GTX675m
Blender Version
2.71 official
Short description of error
The FBX exporter gives an error when trying to export a mesh that is using some materials linked from other .blend files.
Exact steps for others to reproduce the error
It's very easy to reproduce:
Changed status to: 'Open'
Added subscriber: @piiichan
Two example files : example_files.7z
One (lib_materials.blend) contains the 3 materials.
And the other (ref_materials.blend) has a cube that links to them. Try to export the cube to FBX, it won't work.
Added subscriber: @mont29
Added subscriber: @ideasman42
This issue was referenced by
07747bcf64
Changed status from 'Open' to: 'Resolved'
Closed by commit
07747bcf64
.I modified the line you committed
(https://developer.blender.org/rBA07747bcf64963eefaff8aaa9cee24ed652fda5b9)
in my export_fbx_bin.py.
And now my exported FBX models don't have the materials that are using nodes, is this normal ? (I'm still using Blender 2.71 official to test your change)
If that's normal, then I think it's not an acceptable solution at all.
The way I expect it to work is: my exported FBX models have all their materials, just like in Blender. Even node-based materials. If node-based materials can't be correctly "coded" in FBX, then just let them be default materials in the FBX file, so we can tweak/rebuild/code them in the target game engine/renderer. Right now I can't do anything, they're just gone.
Nodal materials were never supported at all. Bug was that they were still being tried, in this specific part of the code, when they should not.
I do not really see the point in exporting dummy data, if you have to re-create them in other app, you can as well re-create them from scratch…
And no, exporting nodal materials is not considered a TODO currently, it does not really makes sense anyway.
I do recreate them, but I can't necessarily be able to specify in other apps what parts of the mesh should have them applied, I use Blender for that.
I'm using the Unity game engine, it lets me do whatever I want with a material from an imported 3d model, like writing custom realtime shaders. But the sub-meshes Unity generates for an imported 3d model are per material, and this info is in the FBX file. If the material is not even present in the FBX file, I can't apply different materials to different parts of a mesh.
Node-based materials are very common in Blender nowadays. Does it mean that a mesh should have zero material if all of its materials are node-based ? It doesn't make sense to me... There should be default placeholder materials in the FBX file instead, meaning "There is a material here, we weren't able to correctly describe it in FBX's terms, but it should be there". With the current solution, 100% of the information is lost, even the name of the material, and the parts of the mesh it's applied to.
Anyway, I can work around it using a bit of scripting in Blender.
And thanks for the quick "fix" nevertheless :)
Oh… did not thought about the 'multimats per mesh' case :/
Will have a look at that, then.
Better fix in
e35de9d174
then! :)Now unexportable mats are still 'written' as default FBX materials, so they are usable as placeholders.
I copy/pasted your changes from https://developer.blender.org/rBAe35de9d174291adab3b28ba660962dc0b084d9d3 into my export_fbx_bin.py
I'm still in Blender 2.71, so I hope your changes are compatible with that version... (Replacing my whole file with the new one gave me errors on export)
I tried exporting 3d models (old and new) that are using nodal materials, and it looks like the FBX export is now working fine. I just get a default diffuse gray material in Unity in place of my nodal materials, which is just what I expect, excellent.
I'm just speaking for myself here, but I think this behavior is the most logical one. It's also the most conservative approach, which is better than a destructive one.
I found another issue: if I add a material slot to the mesh, but if I leave it empty (no material assigned to it), the export fails. See image below
Thanks, fixed in
3365561271
(own stupid mistake :/ ).This issue was referenced by 3f0687b8ad95e7fec6f1469389f08f5dd0915f32