Is there currently any mechanism to animate a skinned model by programmatically updating bone joint angles?
My interest would be to e.g. implement inverse kinematics for accurate walking animation based on foot placement, and other complex behaviours which cannot be achieved by stored animation. And also mechanisms to allow skins to be switched but motion controllable with a unified interface.
I imagine this would require GPU implementation to move the mesh vertices according to the bone transformations, and realistically deform the mesh near joints, maintaining volume etc.
Indeed, in short â itâs not ready yet, and it will be done by making glTF skinned animation on GPU. This is mentioned on our roadmap Roadmap | Castle Game Engine (" Load and animate glTF more efficiently"). Itâs quite important for me, and will definitely happen in 2022, I hope in Q2 of 2022.
Longer description: We have 2 approaches to skinned animation in CGE.
glTF skinned animation. This is a modern approach that can be very efficient, and such animation can be exported e.g. from Blender->glTF already.
Our current implementation is poor: we actually âbakeâ the animation (converting bone movement into final mesh states) when loading. This âbakingâ was done because it was the simpler way to implement it originally⌠but is problematic, it consumes memory, consumes loading time, and prevents you from being able to move bones by code at runtime. I.e. you can move the bones by code at runtime, but right now it will not affect the mesh.
So we want to improve this glTF skinned animation handling
There is another approach to skinned animation using H-Anim: H-Anim component | Castle Game Engine . The result of bone movement is calculated at runtime in this case, so basically it actually has the feature you ask for. HoweverâŚ
The current implementation applies bones on CPU, not GPU, and it thus quite slow, thereâs a noticeable overhead at runtime.
Moreover, H-Anim didnât get much support. Blender, 3ds Max, Maya â they cannot export to a skinned animation using H-Anim, from what I know.
So I donât really plan to extend this path in CGE.
Yes. I mean around the end of June 2022, it will be in the version where it is performed on GPU and the bones can be moved from code (and affect the skin properly).
The glTF skinned animation itself (without above features) works already, i.e. skinned animation that you just design in e.g. Blender and export to glTF works OK already
Iâm just a beginner in 3D animation, but just so I understand:
Would this mean you could have a âHeadâ bone on the playerâs model, and then get the head to look around the level - eg. rotate 30 degrees left, or rotate 10 degrees up, so it looks like the player is looking around the level when you come close to different points of interest? Like looking down a hole, or at a treasure chest?
I know itâs been some time, but it is still a TODO Iâm afraid. Itâs part of our roadmap ( Roadmap | Manual | Castle Game Engine â âWe should also perform skinning fully on GPUâ ). It is important, we will implement it, it just competes with a few other things that are important