Issue with glTF and textures


(Max Limper) #1


I am currently encountering an issue with a textured glTF model.

Two things seem strange:
1) When I re-upload the base color map (using "manage textures" in the 3D settings backend), it gets flipped
2) Independent from 1), the "lowres" / "preview" version of the texture, which is used during loading, also looks strange for the glTF model. It looks way better for the OBJ version of the same model (same data, just different format). The final texture looks good, but the pixelated preview texture for some reason only looks good for the OBJ version.

glTF model:

OBJ model:

Any ideas? Could this be a bug?

Many thanks in advance!

(Waleguene) #2

Hi @max.limper,

It's not actually a bug but more a specificity with glTF files. Because glTF specifications considers UNPACK_FLIP_Y_WEBGL flag disabled and Sketchfab has it enabled, all the textures are flipped during processing.
If you add textures in the 3D editor, they will not be flipped and will look wrong on the model.

This behaviour has been added at the very beginning of glTF support on Sketchfab, and it's probably not the best solution. We had a few reasons to not flip the UVs (that I forgot), but I guess we should update this to allow adding textures through the 3D editor.

I opened a ticket on our side to discuss this. In the mean time, the workaround would be to manually flip the images using Gimp or another image tool before adding it in the editor.

(Max Limper) #3

Hi @waleguene,

many thanks for your quick reply!

The workaround you propose seems feasible, also not a big deal anyway since one can always re-upload the hole model.
For what it's worth, the preview texture now also looks OK, which is strange since I didn't change anything - maybe some caching issue...

This is what I got before, but I can't reliably reproduce - it's probably not something related to gltf then:

I first thought the chance of getting the ugly version was higher for the glTF version, but maybe that's wrong and instead it's just random.

Do you use different preview resolutions, or just one preview texture? The ugly version seems to show the ultra-low-res version for quite a while and then basically directly high-res, while the nice version shows a bit higher resolution from the beginning. The ultra-low-res version is so ugly that I'd rather prefer to have an untextured preview, while the nicer low-res version seems like a good preview while the user waits...

This is actually the more critical issue - should I open another ticket for this?

(Stephomi) #4

The "ugly preview" is using 32x32 textures, while the "nice preview" is using 64x64.
When you save settings in the editor, we compress the textures (generate several resolutions and convert them, etc), it can take a few minutes. Until then the low res preview will use 32x32

Note that in the editor, we always use the uncompressed textures, so you'll always see the 32x32 as a low res preview.

(Max Limper) #5

Ah, that explains it!

With that in mind I'm happy for now, since I know I'll just have to wait a few mins - now the preview also always looks good.

Thank you guys for the quick and efficient support!