|
4 days ago | |
---|---|---|
docs | 4 days ago | |
src | 4 days ago | |
.gitignore | 4 days ago | |
README.md | 4 days ago | |
Res2tf.csproj | 4 days ago | |
UNLICENSE.txt | 4 days ago |
README.md
This repository contains some code that was supposed to help me fix my avatar in Resonite, which turned out to not be appropriate for public instances.
Unfortunately I have yet to actually make the round-trip back into Resonite work properly. Unsure if I'm mapping the bones correctly.
How it works
Because Resonite does not (yet) allow "skinned" meshes (with bones and weights and all that stuff) to be exported in a way that keeps the skinning information, we have to go about it in a more roundabout way:
- Export the model as a Resonite Package, place in
test/Test.resonitepackage
- Open the package, which is actually just a disguised
.zip
archive - Read the
R-Main.record
entry, a JSON file - The
assetUri
field points to the main asset file in the archive - Parse this file using BSON, a very horrible "Binary JSON" format
- The resulting
DataTree
contains the hierarchical node and component info - Types are encoded as IDs, which we can decode using a lookup array
- Process assets we care about, so meshes, textures, and materials
- These assets can then be referenced by their ID by other nodes
- Go through all nodes and attach meshes to them if they have some
- Export the whole thing as
test/scene.glb
with SharpGLTF
NOTE: It might be possible to parse a good chunk of this with Resonite's
own library, but it probably requires setting up an Engine
or so for it to
process all the related files. I don't have the know-how to do that.
NOTE: The paths to the Resonite libraries are hardcoded in Res2tf.csproj
so if you'd like to use this yourself you will have to change them.