How to Fill SkinData

Started by AGP, June 16, 2016, 06:44:26 AM

Previous topic - Next topic

AGP

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.

AGP

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.

AGP

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.

AGP

#18
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.


AGP

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?


     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;
     }

raft

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.

AGP

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).

raft

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.


AGP

#23
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.


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);



AGP

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?

raft

No, I don't do any transformation.

AGP

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).

raft

No, I don't do any transformation.

AGP

Got animation working! Still has a weight problem. I'll post a video soon.

iguatemi

Hi, raft.

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

Thanks