gboisse / gfx

A minimalist and easy to use graphics API.
MIT License
502 stars 36 forks source link

Texture compression support in gltf #44

Closed maoliver-amd closed 2 years ago

maoliver-amd commented 2 years ago

This adds basisu texture compressions and transcoding support for gltf.

In order to support the required basisu extension I ended up having to change the gltf library from tinygltf to cgltf (which also supports other extensions that can be easily enabled as well). This change actually notably simplified the gltf loading code while I tried to keep it similar to what was already there.

I also implemented a non-standard feature in that when a metallicity-roughness texture is found in the gltf file it will look for optional standalone (i.e. separate) texture files for each component. There is discussion about adding this sort of capability as an official extension, as combining metal/rough when using texture compression is not ideal, but it will be a little while before that eventuates so this is an interim workaround.

gboisse commented 2 years ago

It's a bit hard for me to review this just by looking at the code 😅 So I propose that we merge this once the flipped obj textures issue is resolved, then I'll go and test it on content. Really great that we're getting compressed textures support though, we'll be able to test way bigger scenes now 🙂