unavi-xyz / bevy_vrm

Bevy plugin for loading VRM avatars.
https://unavi-xyz.github.io/bevy_vrm/
Apache License 2.0
28 stars 5 forks source link

Update to bevy 0.12 #11

Closed decahedron1 closed 10 months ago

decahedron1 commented 10 months ago

Updates to Bevy 0.12. This requires a new version of bevy_shader_mtoon with https://github.com/unavi-xyz/bevy_shader_mtoon/pull/7.

decahedron1 commented 10 months ago

This broke MToon - replace_mtoon_materials isn't finding any MtoonReplaceMats, not sure why (first time working with Bevy). Marking as draft for now.

kayhhh commented 10 months ago

Just published a new version of bevy_shader_mtoon, gonna take a look at this now

kayhhh commented 10 months ago

Did some refactoring (https://github.com/unavi-xyz/bevy_vrm/tree/0.12) but still running into a similar issue with replace_mtoon_materials not finding data. It will have access to, for example, the GltfMesh assets for a frame or two, then a morph vertex error pops up in the console and the system stops receiving them.

image

Looks like it might be caused by either https://github.com/bevyengine/bevy/issues/10388, or a similar issue with morph targets.

decahedron1 commented 10 months ago

I ran into that error too. I don't think it's related to https://github.com/bevyengine/bevy/issues/10388 as it appeared to work (or at least no longer threw an error) when I manually edited the prepass.wgsl file (note that cargo clean -p bevy_pbr is required to force a rebuild)

-    var vertex = morph::morph_vertex(vertex_no_morph);
+    var vertex = morph_vertex(vertex_no_morph);
kayhhh commented 10 months ago

ah ok, yeah I can see in the bevy commits that seems to be an unrelated error where they messed up the function name when setting the new 0.12 paths.

will have to take a fresh look at this then and figure out why the assets are unloading (I think? I still don't have a great grasp of the asset system)

kayhhh commented 10 months ago

Awesome think I got it working in https://github.com/unavi-xyz/bevy_vrm/pull/12, so gonna close this pr. Ended up doing a lot of refactoring. It still seems a bit convoluted but idk how else to do it, so I'm just happy its working lol.