Add support for exporting yinglets in JSON-based 3D model formats (glTF, VRM, G3MF) #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for exporting yinglets to various open standard file formats, which can be imported into apps:
yinglet_creator_finished_export.mp4
The formats available are glTF, as well as its derived format VRM, both VRM 0.x and VRM 1.0. There is also G3MF, the 3D version of G4MF, full disclosure this is a format I've been developing myself so I'm biased.
Regardless of which option you choose, the resulting model will be enriched with various pieces of metadata, including Khronos character/avatar data, Khronos XMP copyright metadata, bone lengths, eye animations, and lots of VRM data (even if you don't select VRM) such as usage rights, copyright info, humanoid skeleton mappings, spring bones, toon materials, etc. The bone node names follow the Reference Canonical Skeleton Framework standard, which is a standard designed for clarity. Note that most these standards are not yet finalized, so I can't promise there won't be "compatibility breaking" changes in the future, but it doesn't really matter, because these glTF extensions are designed in a way that if the data is unrecognized it is simply ignored.
The code in this PR does not include any libraries, not for glTF, not even a JSON library. It is entirely a custom bespoke exporter designed purely for the needs of Yinglet Creator, including application-specific hacks deep in the export code. The JSON is assembled using StringBuilder, it's primitive but it works for this very constrained use case.
During export, you can select a few different dropdown options, such as how you want the meshes to be merged or not, whether to use PNG or JPEG images, and the float precision level. Note that the eyes are always on a separate surface (or mesh), this allows the eyes to have their texture transforms animated.
The model is exported with the scale baked in, so the sliders you set in Yinglet Creator have their effects preserved. This means that the model is effectively ready-to-go for apps like VRChat (except you'll either need to install UnityGLTF in the Unity project where you have the VRChat SDK, or use Blender to convert the glTF to FBX).
I tested importing the resulting files in these apps (first two shown in the video):
VRM-0.131.0_3b99packageKnown limitations: