KhronosGroup / glTF-Compressor

To store the source code for the glTF-Compressor project
Other
58 stars 6 forks source link

add VRM support #21

Open madjin opened 7 months ago

madjin commented 7 months ago

Simple change that allows one to drag and drop + export a VRM avatar file. I've tested in a number of sample avatars and it works. Afaik this is the cleanest way to process VRM files with KTX compression.

I didn't add any UI changes that explicitly mention how VRM is supported, just don't think its necessary in preventing people from doing such. VRM are technically gltf files but might not be recognized as an official standard yet. For more info: https://vrm.dev/en/vrm/vrm_about/

image

image

Here I rename a VRM sample back to glb and test in gltf-viewer, confirmed extension is there: image

Tested the VRM output with KTX in a number of programs like hyperfy, oncyber, monaverse, upstreet, and all confirmed working.

CLAassistant commented 7 months ago

CLA assistant check
All committers have signed the CLA.

madjin commented 7 months ago

I also modified the github action such that it will build a demo site in a separate gh-pages branch which can be deployed from the same repo as the codebase instead of being separated like it is now (https://github.com/KhronosGroup/glTF-Compressor-Release). Can see it working in my fork.

Demo: https://madjin.github.io/glTF-Compressor/

This version imports and exports a VRM, but the UI doesn't reflect that. I wasn't sure about how Khronos might treat unofficial standards. If you compress VRM textures and click export glTF, it will retain the VRM extension when saving. I just didn't want to deprive creators from a simple drag and drop solution for KTX compression. VRM is becoming a very popular format and there hasn't been an easy solution up until now. This is the best GUI application to do it according to KTX Artist Guide.

gm3 commented 6 months ago

Great idea

madjin commented 6 months ago

Something broke in which the VRM files become corrupted when I export, trying to backtrace these last two commits:

VRM 1.0 file has less errors than VRM 0.x file it seems image

It's not detecting filename extension and changing the Flavour anymore either image

vrm-0.zip vrm-1.zip

I have a working version online from when things were working in December: https://m3org.com/optimize/ Here's where I'ma test some changes with current version of glTF-Compressor: https://github.com/madjin/glTF-Compressor/tree/vrm-fix