You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.7 KiB
36 lines
1.7 KiB
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 disguised `.zip` archive |
|
- Parse 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 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 supported asset types: Meshes, textures, and materials |
|
- These assets can then be referenced by their ID by other nodes |
|
- Go through all node 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 |
|
parse all the related files, I don't have the know-how to do that. |
|
|
|
**NOTE:** The path to the Resonite libraries is hardcoded in `Res2tf.csproj` |
|
so if you'd like to use this yourself you will have to change this. |
|
|
|
[Resonite]: https://resonite.com/ |
|
[SharpGLTF]: https://github.com/vpenades/SharpGLTF |
|
[BSON]: https://bsonspec.org/ |