Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keeping extras from VRM #198

Closed
fire opened this issue Dec 4, 2020 · 7 comments
Closed

Keeping extras from VRM #198

fire opened this issue Dec 4, 2020 · 7 comments

Comments

@fire
Copy link

fire commented Dec 4, 2020

Hello,

I have a vrm file. It's a modification of a glb file.

When I rename it to a glb, and then do .\gltfpack.exe -ke -kn -km -ke -i '.\Short Haired Girl Black Dress Less Poly 3.glb' -o 'Short Haired Girl Black Dress Less Poly 4.glb'.

VRM importers fails to load it as a vrm.

I have tried the -ke option.

Any suggestions?

Short Haired Girl Black Dress Less Poly 3.zip

All Rights Reserved. Ask me if you want license details.

https://github.com/saturday06/VRM_IMPORTER_for_Blender is an blender addon for VRM.

@fire fire changed the title Keeping extras Keeping extras from VRM Dec 4, 2020
@avaer
Copy link

avaer commented Dec 4, 2020

It would be useful to us too if the VRM extensions were not removed during the meshopt process. 👍

@fire
Copy link
Author

fire commented Dec 5, 2020

This is my attempt to patch meshoptimizer.

fire#1

Looking for suggestions.

git clone https://github.com/fire/meshoptimizer.git -b vrm 
cd meshoptimizer
mkdir build
cd build
cmake -DMESHOPT_BUILD_GLTFPACK=ON ..
make
wget https://github.com/Miraikomachi/MiraikomachiVRM/raw/master/Miraikomachi.vrm
./gltfpack -si 0.1 -noq -ke -ke -i "Miraikomachi.vrm" -o "Miraikomachi Optimize.vrm"
# Open in a vrm importer.

My Blender vrm importer is currently failing so it's hard to verify even on the standard alicia model.

@zeux
Copy link
Owner

zeux commented Dec 5, 2020

I'm not familiar with VRM but if it's just about preserving the top-level extension node "VRM", it should be simple. The change above might be too broad though, as it would preserve some top-level extensions where extra work needs to be performed to make the content work, e.g. KHR_xmp.

My suggestion thus would be to simply detect when "VRM" is present in the extension list (regardless of input options, or maybe using -ke for this is fine) and, if so, output just that extension blob, using appendJson which performs JSON minification.

Feel free to submit a PR along these lines. I don't have a way to test this so testing suggestions would be welcome.

@fire
Copy link
Author

fire commented Dec 5, 2020

BEFORE 7.6M AliciaSolid_vrm-0.51.vrm
AFTER 5.5M   AliciaSolid_vrm-0.51-opt.vrm

From https://github.com/vrm-c/UniVRM/tree/master/Tests/Models/Alicia_vrm-0.51

Using https://vrm-viewer.yukimochi.io/ importer.

image

AliciaSolid_vrm_opt.zip from

Notes for posterity.

On fire@7ab13de

./gltfpack -si 0.8 -noq -km -kn -ke -i "AliciaSolid_vrm-0.51.vrm" -o  "AliciaSolid_vrm-0.51-opt.vrm"

@fire
Copy link
Author

fire commented Dec 5, 2020

Thanks for the review.

I can scan for the "VRM" extension. However, I noticed some problems with extras not being sent through.

  1. Enable "VRM" when seen
  2. Keep extras code the same.

@fire fire mentioned this issue Dec 5, 2020
@fire
Copy link
Author

fire commented Dec 29, 2020

I slept thinking about this optimization, because Godot Engine added autolod, I don't have a requirement for this.

The pr is salvageable for all those webxr based avatar multiverses out there. @avaer

@fire fire closed this as completed Dec 29, 2020
@Ry3yr
Copy link

Ry3yr commented Aug 24, 2024

I hope vrm support is still being worked on.

The only other "tool" https://github.com/infosia/vrmpack?tab=readme-ov-file that was apparantly "merged into meshoptimizer" is really a drag to compile and use...

And messing with blendshapes and such is hardly a good way to downsize a .vrm.

After all there are not many good tools for vrm (pmx has dozen.. but vrm ? )

PS:

And yes, vrm is heavily glb based (unity) but vrm has some weird quirks that need to be heeded for it to still be usable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants