So if you toggle between using a shader and not for the bones things go crazy. Not really sure if there is some other command I need to do when switching back or if this is a bug.
The bug occurs when switching from
computeBonesUsingShaders = false to
My guess is that the bones properties (position, rotation) are modified by the software skinning computation and not reset when switching to GPU skinning, but it does not explain why the bones for the legs are still ok after the switch…
I stand corrected, the bones of the legs are wrong too.
After quick inspection, it seems the vertex buffer is updated by the software skinning but not reset back when going back to GPU skinning.
I don’t know if it’s by design or not… Handling this by the engine would mean doing a copy of the vertex (and normal) buffers for all meshes so that we can reset them back in the case you switch from software to gpu skinning. That seems a bit heavy to me… Maybe it’s the responsibility of the user to do it (the duplication of the buffers and setting them back when switching to GPU skinning)? @Deltakosh or @sebavan, what do you think?
For me, this switch is not something you should change continuously: you normally set a value at start and don’t change it afterward.
I have a project where we need to have the mesh be pick-able at certain times and other times not that has skeletal animations on it. So we for specific reasons need to be able to. Might be kinda a fringe case, but figured it was good to bring up.
Technically it is not supposed to be changed live. you have to stick with one way and don;t change later on
In fact, the source position and normal buffers are currently already saved in internal data of the meshes…
So I think it would be easy to reset the buffer to their original values when switching
computeBoneUsingShaders from false to true.
Going to make a PR for it.
Please do! That will knock one major item off my list.