glTF-Blender-IO icon indicating copy to clipboard operation
glTF-Blender-IO copied to clipboard

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

Open kitaedesigns opened this issue 1 year ago • 10 comments

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

  • OS: [e.g. macOS, linux]
  • Blender Version 4.0.0 and 4.0.2

Additional context Add any other context about the problem here.

kitaedesigns avatar Dec 08 '23 15:12 kitaedesigns

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

julienduroure avatar Dec 08 '23 17:12 julienduroure

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 avatar Dec 11 '23 21:12 kitaedesigns

This is a file with 16K textures.

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

kitaedesigns avatar Dec 11 '23 22:12 kitaedesigns

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

julienduroure avatar Dec 11 '23 22:12 julienduroure

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()

julienduroure avatar Dec 11 '23 22:12 julienduroure

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

scurest avatar Dec 12 '23 17:12 scurest

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

kitaedesigns avatar Dec 13 '23 14:12 kitaedesigns