Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot 3.2.4 does not actually use separate textures for GLTF files exported with separate textures enabled (they're instead embedded in the materials). #44309

Closed
EzraT opened this issue Dec 11, 2020 · 13 comments · Fixed by #44939

Comments

@EzraT
Copy link

EzraT commented Dec 11, 2020

Godot version: v3.2.4.beta4.official, affects master as well.

OS/device including version: Linux Mint 20 x86_64

Issue description:
image
When exporting a blender scene to GLTF for use in Godot 3.2.4.beta4, with the export settings shown in the screenshot above, with textures exported into a folder instead of packed into the GLTF itself, Godot is supposed to use those textures in the resulting SpatialMaterial resources after importing.

beta4 currently fails to do this, even with separate textures enabled, it always ends up packing the textures directly into the SpatialMaterial, leaving the textures in the exported folder unused.

This does not happen in 3.2.3, so I'm guessing some regression may have happened at some point.

Steps to reproduce:

  1. Setup a blender scene in a recent version of blender, 2.8 or 2.9.
  2. Make sure textures are used in it. (ofcourse)
  3. When exporting to GLTF, make sure to set it so it exports textures separately. (as shown above)
  4. After exporting to Godot, right click the resulting SpatialMaterial(s), and click "Edit Dependencies".
  5. Notice that there are no dependencies.
@Calinou
Copy link
Member

Calinou commented Dec 12, 2020

cc @fire

@EzraT
Copy link
Author

EzraT commented Dec 12, 2020

I hope this one can get fixed before 3.2.4.stable releases, my workflow relies heavily on this working correctly, since GLTF currently works the best out of all the export options available right now for me.

@fire
Copy link
Member

fire commented Dec 12, 2020

Are you able to do a bisect to find the commit that change the behaviour? I have some suspects.

Like use git bisect and take your project and do a check on the bug until you find a version that doesn't error. Then tell me the version that errors and the version that doesn't error.

@EzraT
Copy link
Author

EzraT commented Dec 12, 2020

@fire
For what its worth, all of the 3.2.4 betas suffer from this issue, so it has to be a commit from sometime before beta 1.
I found 3 commits that involve GLTF related changes for beta1, I have no way of knowing if any of them are related to this problem though.

460ab35
177d16c
9529ce4

@fire
Copy link
Member

fire commented Dec 12, 2020

9529ce4#diff-391b8dac176705a7434fd9ca93ac540183658308fcb6a91cc40f6f2ecd4439baR1384 is suspicious, but I'm currently busy and in the middle of something.

@EzraT
Copy link
Author

EzraT commented Dec 23, 2020

On an extra note, this issue affects the 4.0 master branch as well currently, but I'm guessing this will probably be resolved with the upcoming 3D asset import rework for 4.0.

@akien-mga akien-mga added this to the 4.0 milestone Jan 5, 2021
@akien-mga
Copy link
Member

Might indeed be related to #42504, I'll have a look. It would help me out if there was a minimal reproduction project that I can use right away to debug the issue.

@EzraT
Copy link
Author

EzraT commented Jan 5, 2021

@akien-mga
mrp.zip

This includes a blender file that you can use for exporting, open it in blender, export it to GLTF using the export settings shown in the OP, export it to the import folder in the MRP to reproduce. (or anywhere in the project folder, does not really matter where)

@akien-mga
Copy link
Member

Thanks! I exported as described with Blender 2.91.0, and it seems to work fine for me in Godot 3.2.4 beta 4 and latest 3.2 branch:
Screenshot_20210105_152232

Can you still reproduce it, and which Blender version do you use?

@EzraT
Copy link
Author

EzraT commented Jan 5, 2021

Please read the OP carefully, I'm not talking about the GLTF dependencies, this issue concerns the textures that are copied over, they do not get linked to the materials, instead they get packed inside of them, leaving the ones in the texture folder unused.

So check the dependencies of the resulting SpatialMaterials.

@akien-mga akien-mga changed the title Godot 3.2.4.beta4 does not actually use seperate textures for GLTF files exported with seperate textures enabled. Godot 3.2.4 does not actually use separate textures for GLTF files exported with separate textures enabled (they're instead embedded in the materials). Jan 5, 2021
@akien-mga
Copy link
Member

Thanks, I can confirm that. The .material files are indeed 3 MB of embedded data.

@akien-mga
Copy link
Member

Indeed this change is wrong: https://github.com/godotengine/godot/pull/42504/files#diff-391b8dac176705a7434fd9ca93ac540183658308fcb6a91cc40f6f2ecd4439baR1322-R1338

This causes loading the external images as a byte array instead of a resource if it has a proper mimeType, which is wrong. I'll fix it.

@EzraT
Copy link
Author

EzraT commented Jan 5, 2021

@akien-mga Thanks a bunch!

akien-mga added a commit to akien-mga/godot that referenced this issue Jan 5, 2021
We should first attempt loading as external files, thus creating a dependency.
Loading as a buffer should only be used as fallback to support manually loading
as PNG or JPEG depending on the defined mimeType.

Fixes godotengine#44309, was a regression from godotengine#42504.
akien-mga added a commit to akien-mga/godot that referenced this issue Jan 5, 2021
We should first attempt loading as external files, thus creating a dependency.
Loading as a buffer should only be used as fallback to support manually loading
as PNG or JPEG depending on the defined mimeType.

Fixes godotengine#44309, was a regression from godotengine#42504.

(cherry picked from commit e268a8e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants