Jump to content

implementation of bone animation


toly1917
 Share

Recommended Posts

Hi, everybody. There are difficulties with realization of skeletal animation.
There is json the file with all mesh, materials and skeletons. Each animated mesh has properties:
  • "boneIndex" (array of bones which are tied with tops)
  • "boneWeight" (weight of all tops)
All bones have such parameters, as:
  • "id",
  • "parentId" (the identifier of a parental bone (if that isn't present, =-1)),
  • "matrix" (I am so understood, it is a matrix on the basis of which there are transformations (as if the center of transformations though I can be mistaken)),
  • "frames" (array of all frames of animation)
Question: How to realize skeletal animation in a shader and how to realize system "the parent - the child"?
animation example from file json:
"skeletons": [{    "name": "skelet",    "bones": [{        "name": "Bone",        "index": 0,        "matrix": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, -0.6955, -0.647, -2.3721, 1],        "parentBoneIndex": -1,        "animation": {            "dataType": 3,            "framePerSecond": 24,            "keys": [{                "frame": 1,                "values": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, -0.6955, -0.647, -2.3721, 1]            }, {                "frame": 2,                "values": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, -0.6955, -0.647, -2.3721, 1]            }... {                "frame": 30,                "values": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, -0.6955, -0.647, -2.3721, 1]            }],            "loopBehavior": 1,            "name": "anim",            "property": "_matrix"        }    }, {        "name": "Bone.001",        "index": 1,        "matrix": [0.7021, 0, -0.712, 0, -0.3347, 0.8826, -0.3301, 0, 0.6285, 0.4701, 0.6197, 0, 0, 1, 0, 1],        "parentBoneIndex": 0,        "animation": {            "dataType": 3,            "framePerSecond": 24,            "keys": [{                "frame": 1,                "values": [0.7021, 0, -0.712, 0, -0.3347, 0.8826, -0.3301, 0, 0.6285, 0.4701, 0.6197, 0, 0, 1, 0, 1]            }, {                "frame": 2,                "values": [0.7021, 0.0029, -0.712, 0, -0.3347, 0.8839, -0.3265, 0, 0.6285, 0.4676, 0.6216, 0, 0, 1, 0, 1]            }, {                "frame": 3,                "values": [0.7021, 0.0115, -0.7119, 0, -0.3347, 0.8878, -0.3158, 0, 0.6285, 0.46, 0.6272, 0, 0, 1, 0, 1]            }... {                "frame": 30,                "values": [0.7021, 0.7012, 0.1236, 0, -0.3347, 0.1719, 0.9265, 0, 0.6285, -0.6919, 0.3554, 0, 0, 1, 0, 1]            }],            "loopBehavior": 1,            "name": "anim",            "property": "_matrix"        }    }]}]

If the application code is necessary, I will kindly provide it :)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...