Hi,
I am confused about how the weights are stored in the glTF file. With the following example (stripped for clarity), the vertex positions, joints and weights come out as shown below. The issue for example is with the first vertex, which is completely influenced by joint 0 according to the weight. But this is the lowest vertex in the model i.e. closer to joint 1 (which lies below joint 0 according to the vertical translation transformation of joint 0).
Hence, reading the data as given results in the model being animated upside down compared to blender, where the glTF file was extracted from. What is the issue?
Vertices:
[ -0.5, 0, 0 ]
[ 0.5, 0, 0 ]
[-0.5, 0.5, 0]
[0.5, 0.5, 0]
[-0.5, 1, 0]
[0.5, 1, 0]
[-0.5, 1.5, 0]
[0.5, 1.5, 0]
[-0.5,2,0]
[0.5,2,0]
Joints:
[0,0,0,0]
[0,0,0,0]
[0,1,0,0]
[0,1,0,0]
[0,1,0,0]
[0,1,0,0]
[1,0,0,0]
[1,0,0,0]
[1,0,0,0]
[1,0,0,0]
Weights:
[1.0, 0.0, 0.0, 0.0]
[1.0, 0.0, 0.0, 0.0]
[0.75, 0.25, 0.0, 0.0]
[0.75, 0.25, 0.0, 0.0]
[0.5, 0.5, 0.0, 0.0]
[0.5, 0.5, 0.0, 0.0]
[0.75, 0.25, 0.0, 0.0]
[0.75, 0.25, 0.0, 0.0]
[1.0, 0.0, 0.0, 0.0]
[1.0, 0.0, 0.0, 0.0]
{
…
“nodes”:[
{
“name”:“Node_2”,
“rotation”:[
1.319117231285828e-16,
1.0025483360881847e-23,
-3.931275304963976e-24,
1
],
“translation”:[
-1.0587911840678754e-22,
0.9999998807907104,
3.552713678800501e-15
]
},
{
“children”:[
0
],
“name”:“Node_1”,
“rotation”:[
-8.557136332854043e-09,
1.7114272665708086e-08,
-2.928983286277023e-16,
1
]
},
…
“skins”:[
{
“inverseBindMatrices”:5,
“joints”:[
1,
0
],
“name”:“Armature”
}
],
…
}