FBX Export 3.1 Missing/texture Wrong UV #96538

Open
opened 2022-03-16 21:58:10 +01:00 by stu rentz · 13 comments

System Information
Operating system: Mac 11.6.4 + Also headless on Ubuntu
Graphics card: AMD Radeon R9 M295X 4 GB

Blender Version
Broken: (3.1) Mac install and Snap on Ubuntu
Worked: (3.0) Mac install and Snap on Ubuntu

Short description of error
On export of FBX file (attached character.glb) when exporting as FBX "Copy" and "Embed textures". When importing the FBX into any Blender version the character UV is wrong / texture map missing based on file size being smaller.

Did on Mac and also on Ubuntu.
Exporting works for 3.0 headless and on Mac... can export this file as FBX and reimport it into with no issues.

Exact steps for others to reproduce the error
0. Blender 3.1

  1. Import GLB attached.
  2. File > Export > FBX
  3. Select "Copy" and "Embed" textures.
  4. Save/Export button
  5. File / New Project (or exist blender and restart)
  6. File / Import / FBX
  7. Select the exported FBX file

Repeat above steps with Blender 2.93 or 3.0 to see export work.
Based on the default startup or an attached .blend file (as simple as possible).

character.glb

screen.png

**System Information** Operating system: Mac 11.6.4 + Also headless on Ubuntu Graphics card: AMD Radeon R9 M295X 4 GB **Blender Version** Broken: (3.1) Mac install and Snap on Ubuntu Worked: (3.0) Mac install and Snap on Ubuntu **Short description of error** On export of FBX file (attached character.glb) when exporting as FBX "Copy" and "Embed textures". When importing the FBX into any Blender version the character UV is wrong / texture map missing based on file size being smaller. Did on Mac and also on Ubuntu. Exporting works for 3.0 headless and on Mac... can export this file as FBX and reimport it into with no issues. **Exact steps for others to reproduce the error** 0. Blender 3.1 1. Import GLB attached. 2. File > Export > FBX 3. Select "Copy" and "Embed" textures. 4. Save/Export button 5. File / New Project (or exist blender and restart) 6. File / Import / FBX 7. Select the exported FBX file Repeat above steps with Blender 2.93 or 3.0 to see export work. Based on the default startup or an attached .blend file (as simple as possible). [character.glb](https://archive.blender.org/developer/F12930601/character.glb) ![screen.png](https://archive.blender.org/developer/F12930608/screen.png)
Author

Added subscriber: @clayrain

Added subscriber: @clayrain

Added subscriber: @scurest

Added subscriber: @scurest

This is caused by a change in the glTF importer. For images embedded in the file, it used to write the image data to a uniquely-named tempfile and load that. It now packs the data directly with img.pack() and does not set the image's filepath at all. I think the FBX exporter is using the filepath as a key, so it treats all images that have a blank filepath (which is all of them in this case) as the same.

This could be fixed by either having the FBX exporter handle blank filepaths, or by having the glTF importer assign images a unique "fake" filepath when importing.

I looked at the FBX importer and it always sets a filepath on images.

This is caused by a change in the glTF importer. For images embedded in the file, it used to write the image data to a uniquely-named tempfile and load that. It now packs the data directly with `img.pack()` and does not set the image's filepath at all. I think the FBX exporter is using the filepath as a key, so it treats all images that have a blank filepath (which is all of them in this case) as the same. This could be fixed by either having the FBX exporter handle blank filepaths, or by having the glTF importer assign images a unique "fake" filepath when importing. I looked at the FBX importer and it always sets a filepath on images.

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Added subscribers: @JulienDuroure, @mont29

Added subscribers: @JulienDuroure, @mont29

@JulienDuroure I would rather not have blank filepaths in images in general, even if they are packed in Blender... So think this should rather be fixed from glTF side than FBX one?

@JulienDuroure I would rather not have blank filepaths in images in general, even if they are packed in Blender... So think this should rather be fixed from glTF side than FBX one?
Member

@mont29

  • What about generated files? FBX exporter still have a problem in that case, doesn't it?
  • Setting a filepath to packed images --> This displays on console, during glb import : ERROR: Image "" not available. Keeping packed image.

Any idea why this error message? BTW even with this error message, seems glb import works

for setting filepath --> https://developer.blender.org/diffusion/BA/browse/master/io_scene_gltf2/blender/imp/gltf2_blender_image.py$92

@mont29 - What about generated files? FBX exporter still have a problem in that case, doesn't it? - Setting a filepath to packed images --> This displays on console, during glb import : ERROR: Image "" not available. Keeping packed image. Any idea why this error message? BTW even with this error message, seems glb import works for setting filepath --> https://developer.blender.org/diffusion/BA/browse/master/io_scene_gltf2/blender/imp/gltf2_blender_image.py$92

@JulienDuroure

  • Indeed generated pictures are not supported by FBX currently. But this is a separated issue imho.

  • I do not understand why you try to change the source property of your image here? either it is packed, and then just set its filepath property, or it is indeed extracted on disk, in which case you can switch its source to FILE after having set a valid filepath?

@JulienDuroure * Indeed generated pictures are not supported by FBX currently. But this is a separated issue imho. * I do not understand why you try to change the `source` property of your image here? either it is packed, and then just set its `filepath` property, or it is indeed extracted on disk, in which case you can switch its `source` to `FILE` *after* having set a valid filepath?

I do not understand why you try to change the source property of your image here?

AFAIK, the packed file is only used if the source is 'FILE' (just like eg the generated_color is only used if the source is 'GENERATED'). When the image is created with images.new, the source is initially 'GENERATED' so it needs to be switched to 'FILE' to actually use the packed file.

IMO it would be better to fix the FBX side since the glTF importer is not the only place images like this could come from.

>I do not understand why you try to change the source property of your image here? AFAIK, the packed file is only used if the source is 'FILE' (just like eg the generated_color is only used if the source is 'GENERATED'). When the image is created with images.new, the source is initially 'GENERATED' so it needs to be switched to 'FILE' to actually use the packed file. IMO it would be better to fix the FBX side since the glTF importer is not the only place images like this could come from.

I've been following this issue and I used to have this working in Blender 3.0.1. But today I can't get Blender 2.93, Blender 3.0.1 or Blender 3.4 to work. They all result in missing textures.

I've been following this issue and I used to have this working in Blender 3.0.1. But today I can't get Blender 2.93, Blender 3.0.1 or Blender 3.4 to work. They all result in missing textures.
Author

I have a workaround I built on my server using a headless blender install. Since I needed to do this often for work I made it an online app.

@Michael-Cawood let me know if this if for you (one time) or studio needs. For one time, the workaround is like this:
1.Import model
2.Explort as gltf (with the settings for seperate textures)
3.Reimport that gltf
4. Now you can export as FBX or whatever.

Hope this helps make your modeling conversion time happier.

I have a workaround I built on my server using a headless blender install. Since I needed to do this often for work I made it an online app. @Michael-Cawood let me know if this if for you (one time) or studio needs. For one time, the workaround is like this: 1.Import model 2.Explort as gltf (with the settings for seperate textures) 3.Reimport that gltf 4. Now you can export as FBX or whatever. Hope this helps make your modeling conversion time happier.

@clayrain Genius! Yes, that fixed it. Well done. Thank you. I used Blender 2.93 for it to work.

@clayrain Genius! Yes, that fixed it. Well done. Thank you. I used Blender 2.93 for it to work.
Author

@Michael-Cawood glad it worked. Good luck with your project!

Any love for me Blender and the rest of us? Feel like fixing this issue yet???

@Michael-Cawood glad it worked. Good luck with your project! Any love for me Blender and the rest of us? Feel like fixing this issue yet???
Sign in to join this conversation.
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#96538
No description provided.