gboisse / gfx

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

Improve GLTF loading support for compressed textures. #137

Closed maoliver-amd closed 5 months ago

maoliver-amd commented 5 months ago

This adds an additional material flag for exposing GLTF alpha mode values. These are values used to define the alpha blending mode for a material (i.e. opaque, blend or clip) and are intended to be used to determine if alpha testing should be performed on a surface and not just by checking if albedo has an alpha channel (which is done currently). Since for compressed textures (especially BC7) there is no method to actually detect if the texture contains non opaque alpha channel data then the alpha mode flag should be used instead.

This also fixes an issue with loading GLTF scenes that only contain compressed textures (either basisu ktx or dds) and not any uncompressed textures. In this case the previous behaviour would fail to match images to materials and textures would be displayed.

In addition to the above this also adds support for the AMD_split_roughnessMetallic GLTF extension that enables explicitly setting a separate texture for metallicity and roughness