KhronosGroup / glTF-Blender-IO

Blender glTF 2.0 importer and exporter
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
Apache License 2.0
1.5k stars 319 forks source link

WebP conversion in GLTF Exporter fails if textures are not all same image format or above 8K resolution #2077

Open kitaedesigns opened 11 months ago

kitaedesigns commented 11 months ago

Describe the bug The gltf/glb fails to be exported if there are textures with different formats, i.e. jpg and png textures in the same material. It also fails to export if the resolution of the textures is too high. I am testing exporting textures at 16K that are all jpeg and they fail to export. Also, models with webp textures in blender seem unable to be exported with the image format set to "Automatic" as well.

To Reproduce Steps to reproduce the behavior: Create a cube with a material. Use jpg in Diffuse and png in Roughness, and try to export with WebP textures.

Expected behavior Expected for model to be exported with all textures now WebP.

Version

Additional context Add any other context about the problem here.

julienduroure commented 11 months ago

The gltf/glb fails to be exported if there are textures with different formats, i.e. jpg and png textures in the same material.

I can't reproduce. Please provide a .blend file with all needed textures, and with saved export parameters

Exporting this: image

Using this option: image

Does not crash, and generate some WebP images: image

I am testing exporting textures at 16K that are all jpeg and they fail to export

Please provide a .blend file with all needed textures, and with saved export parameters. Did you have any error displayed? Did you check you have enough RAM on your computer to handle it?

Also, models with webp textures in blender seem unable to be exported with the image format set to "Automatic" as well

I can't reproduce. Please provide a .blend file with all needed textures, and with saved export parameters

Exporting this: image

With this option: image

Does not crash, and generate some WebP images: image

kitaedesigns commented 11 months ago

Here's a link to the file I was working with mismatched textures filetypes. I have 128GB of RAM.

https://www.dropbox.com/scl/fi/88irqdj7upxvh8oocv2ld/automotivebrutalism2.blend?rlkey=cerc6scqz3atlgviua2j5vmbu&dl=0

kitaedesigns commented 11 months ago

This is a file with 16K textures.

https://www.dropbox.com/scl/fi/ekrzhtpxbz0iketi6t9zm/bakehouse.blend?rlkey=a076sko0ew5klbfkkcodvudad&dl=0

julienduroure commented 11 months ago

Your first case is a duplicate of #2081 : Problem comes from a B&W texture

julienduroure commented 11 months ago

For the 16K textures: It looks like a bug on Blender Api side. The following code creates the file for a random texture file, but not for your 16K texture (without any crash). Investigation still in progress, and I may have to contact Blender dev to investigate

import bpy src_image = bpy.data.images['Image_0.png'] new_image = src_image.copy() new_image.update() new_image.filepath_raw = "/tmp/test_save_image" new_image.file_format = "WEBP" new_image.save()

scurest commented 11 months ago

16k textures cannot be converted to WebP. The maximum width and height allowed by WebP is 16383 pixels.

kitaedesigns commented 11 months ago

Ah thank you @julienduroure and @scurest for hunting down the true errors. I think we can mark this closed now.

alexisdrakopoulos commented 2 months ago

16k textures cannot be converted to WebP. The maximum width and height allowed by WebP is 16383 pixels.

I tried 16383x16383 and that also gives me an error

julienduroure commented 1 month ago

Reported the issue on blender side: https://projects.blender.org/blender/blender/issues/128183

julienduroure commented 1 month ago

I tried 16383x16383 and that also gives me an error

I can't reproduce, the image is generated on my side with 16383x16383