This is the summary of my understanding of skeletons and bones https://playground.babylonjs.com/#8HKA9I
The construction of the skeleton and associated mesh is done with the basic building data.
Animation is done through CPU engagement. I’d like to see the code of a similar simple GPU-managed animation, without using other programs … just code.
I still haven’t been able to export the skeleton in .babylon format correctly,
but this is a later problem.
In the PREVIEW section, you will find this texture has size width: 16, height: 1. This texture actually stores values of (n+1) transformation matrix for number of bones n. Each pixel can hold RGBA, so 4 float values. It requires 4 pixels to hold a transformation matrix. E.g. You have 3 bones. So this texture stores 3 + 1 = 4 matrix. Each matrix requires 4 pixels to store 16 float values. Thus, this texture holds 4 transformation matrix.
Fully GPU managed animation I guess you mean baked animation. The idea is to prepare transformation matrix for the full animation at once. For example, if your animation doesn’t have any randomness or doesn’t behave differently based on user inputs. You can prepare (‘bake’) the animation. See babylon.js documentation about baked animation. Basically, if your animation completes for 2 seconds = 120 frames. You calculate the transformation matrix for each of these 120 frames, and prepare a texture that is width 16, height 120. To have a smaller texture e.g. you might only calculate transform matrix of 60 frames (30 frames/s). It will reduce the smoothness of the animation.
Hi slin , thanks for your explanation.
I can build simple 3d structures and can coat them with a texture using a simple text editor. I am aware that such a method is not suitable for building figures with thousands of vertices and triangles.
Even just for my little solids I had to build a little 3d-2d editor that relates the 3d vertices with the corresponding ones on the 2d texture. My goal is to animate small figures with few vertices and few triangles.
I am allergic to using a digger’s bucket to drive a nail … a hammer is enough … With this philosophy and with this goal I would like to see a dozen lines of simple source code that would replace my CPU animations with a simple one animation managed by the GPU. I am aware of how much complexity there is behind the excavator …, or behind the baked texture. Yesterday I spent three hours looking for a manual to regulate a water heater managed by a small display board … An electric water heater for me is a container with a resistance and a thermal switch … that was … another excavator … I just wanted to use the hammer … eheheh.
Just kidding, for fun … or almost.
Let’s go back to the little solids
If the vertices and triangles are few, there are also relatively few animation operations managed by the CPU. I think the math coprocessor takes a few machine cycles to solve “my” simple trigonometric functions.
I don’t rule out changing my mind, but if I write some code I would like to understand what I’m doing …
For our fisher friends here is a small example with about forty vertices and triangles …
I have not found any examples of native skeleton animation, even a simple one.
… Blender, blender, blender … I was practically forced to use it.
I built with Blender a small skeleton with three bones connected to a mesh consisting of three cubes. I animated two bones with a simple lateral rotation and I exported everything in .babylon format.
Only three cubes stacked vertically. I would have expected 24 vertices: 4x4 = 16 + 4 side seams + 2 + 2 seams for the lower and upper faces.
Blender uses 67 vertices …
I don’t criticize Blender but it doesn’t seem geared towards effective LowPolyMesh
Trivial point of view …
I analyzed the .babylon file very patiently, and I roughly removed everything that did not serve my purpose. I replaced the geometry data of the mesh and I reduced everything in a Json datafile.
I reduced everything into a first rough playground. Native Skeleton Animation
I formatted the code better and added the relationship between the transformation matrix and a generic animation frame contained in a .babylon file. Rotation around the Z axis.
With this post I think I have achieved the goal.
Having to work in synthesis, I formatted the data columns by reducing the decimals of the source data.
It is built from scratch, the mesh, the skeleton, the bones and their animations.
I couldn’t find a direct way to proceed without using Blender.
I actually took apart a very simple animated skeleton obtained with Blender.
I made an effort to make the data structures readable.