Author Topic: How to Fill SkinData  (Read 4377 times)

Offline AGP

  • quad
  • ******
  • Posts: 1524
    • View Profile
Re: How to Fill SkinData
« Reply #15 on: August 13, 2016, 02:40:31 pm »
Kind of, sort of. I'm going to see this through, but at the moment it's still broken. I think I'll have news on Thursday.

Offline AGP

  • quad
  • ******
  • Posts: 1524
    • View Profile
Re: How to Fill SkinData
« Reply #16 on: August 24, 2016, 11:33:13 pm »
OK, in all the tests the model appears to both export and import right (then again, there's that pesky UV issue). The next step was always to write an exporter for Blender, so instead we're going to be writing an IMPORTER first. Hopefully I'll have more tomorrow.

Offline AGP

  • quad
  • ******
  • Posts: 1524
    • View Profile
Re: How to Fill SkinData
« Reply #17 on: September 07, 2016, 12:16:04 am »
News: UVs in Blender are proving tougher than expected. But the bones are moving better (still not perfect) than in Bones. I will post screenshots later tonight.

Offline AGP

  • quad
  • ******
  • Posts: 1524
    • View Profile
Re: How to Fill SkinData
« Reply #18 on: September 14, 2016, 09:08:59 pm »
Voilá. UVs and all. Alas, I have no clue about the UV and weight problems (problem?).

UPDATE: Updated the image to include the model in Bones, for comparison's sake.

« Last Edit: September 15, 2016, 12:34:43 am by AGP »

Offline AGP

  • quad
  • ******
  • Posts: 1524
    • View Profile
Re: How to Fill SkinData
« Reply #19 on: November 01, 2016, 03:12:07 pm »
I'm even exporting animations, now. Trouble is Max's quaternions aren't making any sense to me, even when I call invert() (in the MaxScript). I've also included the transformation matrix, as retrieved for each vertex with bone.transform (MaxScript). Either I fix the quaternions or I extract the data from the transform matrix. The following method is used to build a jpct transformation matrix. Given that, how could I go about using the matrix?

Code: [Select]
     private Matrix getTransformationMatrix(JSONArray transformData) {
Matrix transformMatrix = new Matrix();
for (int j = 0; j < 4; j++) {
     JSONArray row = (JSONArray) transformData.get(j);
     transformMatrix.setRow(j,
     ((Number)row.get(0)).floatValue(),
     ((Number)row.get(1)).floatValue(),
     ((Number)row.get(2)).floatValue(), 1f);
}
return transformMatrix;
     }

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: How to Fill SkinData
« Reply #20 on: November 01, 2016, 04:54:22 pm »
I have no idea how Max stores transformation infomation so I have no idea how to pull information out of that matrix.

Try Googling or Max documents.

Offline AGP

  • quad
  • ******
  • Posts: 1524
    • View Profile
Re: How to Fill SkinData
« Reply #21 on: November 01, 2016, 04:58:18 pm »
Again, it's not about max. Sorry I even mentioned the max script. The question was: how do I turn a transformation matrix per vertex per frame into a SkinClip. I'll post how I did it with the quaternions in a little bit, but the matrices are easier to convert (I've already done it or I wouldn't even have a model).

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: How to Fill SkinData
« Reply #22 on: November 01, 2016, 05:45:08 pm »
check javadoc of SkinClip and JointChannel.

think of JointChannel as a series of points in time describing Joint's transformation. times between points are interpolated.

you need to pull translations (SimpleVector) and rotations (Quaternion) data out of a series of that transformation Matrices.


Offline AGP

  • quad
  • ******
  • Posts: 1524
    • View Profile
Re: How to Fill SkinData
« Reply #23 on: November 01, 2016, 07:56:47 pm »
The Matrix method is slightly better than the Quaternion one. Both methods produce a blob of animated polygons (but the Matrix blob has feet and a head somewhere in the middle). Animations are easily identifiable.

Code: [Select]
Matrix transformationMatrix = getTransformationMatrix(transformData);
times[i] = (float)i/(float)framesCount;
// translations[i] = new SimpleVector(((Number)translation.get(0)).floatValue(), ((Number)translation.get(1)).floatValue(), ((Number)translation.get(2)).floatValue());
// rotations[i] = new Quaternion(((Number)rotation.get(0)).floatValue(), ((Number)rotation.get(1)).floatValue(), ((Number)rotation.get(2)).floatValue(), ((Number)rotation.get(3)).floatValue());
translations[i] = SimpleVector.ORIGIN;//transformationMatrix.getTranslation();
rotations[i] = new Quaternion(transformationMatrix);

« Last Edit: November 01, 2016, 07:58:34 pm by AGP »

Offline AGP

  • quad
  • ******
  • Posts: 1524
    • View Profile
Re: How to Fill SkinData
« Reply #24 on: November 23, 2016, 11:16:12 am »
I managed to export and re-import all the animation ciips in 3ds max (other than that UV issue, the imported model is identical to the original). But in order for them to work on Max, I'm exporting them in worldspace. The result works in max but still doesn't in jpct. Do you transform the transformation matrix at all from Ogre or Collada? If so, what do you do?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: How to Fill SkinData
« Reply #25 on: November 23, 2016, 11:18:28 am »
No, I don't do any transformation.

Offline AGP

  • quad
  • ******
  • Posts: 1524
    • View Profile
Re: How to Fill SkinData
« Reply #26 on: November 23, 2016, 11:11:57 pm »
I expect that the answer will be the same, but just to clarify: I meant the transform matrices not of the object itself but of the animation description (per joint per frame, naturally).

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: How to Fill SkinData
« Reply #27 on: November 25, 2016, 03:55:05 pm »
No, I don't do any transformation.

Offline AGP

  • quad
  • ******
  • Posts: 1524
    • View Profile
Re: How to Fill SkinData
« Reply #28 on: November 30, 2016, 06:22:06 am »
Got animation working! Still has a weight problem. I'll post a video soon.

Offline iguatemi

  • byte
  • *
  • Posts: 9
    • View Profile
Re: How to Fill SkinData
« Reply #29 on: December 06, 2016, 04:26:32 pm »
Hi, raft.

Should the vertices' weights be normalized?
I didn't find any reference about it in the docs or in this forum.

Thanks