Hi, thanks for your reply;
1. I have 0.mesh (Green Alien - e.g. directly from EE) and
Green Alien.obj (Just the natural exported .obj - no skinning data). I want to add skinning data to the imported .obj This is my code, but it produces the skinning artefacts in the previous screenshot above (although the colours are all white now).
Code:
Mesh body;
Str8 filename = "Green Alien.obj";
...
// load mesh
body.del(); if (ImportOBJ(filename,&body,mats,parts) && body.vtxs()) {
Tools.setText(S+"Imported Obj! Contains: "+body.vtxs()+" vertexes and "+ ((body.parts()==1)?S+body.parts()+" part!":S+body.parts()+" parts!"),2);
} else {
Tools.setText("Error importing OBJ.",3);
return;
}
body.quadToTri();
body.joinAll(false,false);
for (int i=1; i<body.parts(); i++) body.part(i).del();
body.include(VTX_COLOR|VTX_BLEND|VTX_MATRIX);
FREP (body.base(0).vtxs()) body.base(0).vtx.color[i] = WHITE;
Matrix m; m.setNormalizeY(body.box); body*=m;
body.setRender();
body.skeleton(Meshes("Sample/0.mesh")->skeleton());
FREP( Meshes("Sample/0.mesh")->base(0).vtxs() ) {
body.base(0).vtx.matrix[i].x = Meshes("Sample/0.mesh")->base(0).vtx.matrix[i].x;
body.base(0).vtx.matrix[i].y = Meshes("Sample/0.mesh")->base(0).vtx.matrix[i].y;
body.base(0).vtx.blend[i] = Meshes("Sample/0.mesh")->base(0).vtx.blend[i];
}
// body.load("Sample/0.mesh"); this line makes it "work"
Then in draw:
Code:
case RM_PREPARE : {
body.draw(cskel); // Meshes("0.mesh")->draw(cskel); this comment also makes it "work"
If I uncomment either of the two comments, it draws the correct skinned Green Alien. But this isn't what I want. I want to copy the data into the imported .obj body without the artefacts. (As I need to copy my data into your skinning format; yet at the moment I can't even seem to copy your skinning format into the skinning format
).
2. But if I move along the bone, by distance = blend * Dist(bone.x.pos,bone.y.pos) - do I not get a point along the bone, approximately closest to the vertex?