About Store Forum Documentation Contact



Post Reply 
Low-level questions & high level features
Author Message
Esenthel Offline
Administrator

Post: #16
RE: Low-level questions & high level features
1. I really don't understand the issue.
vertexes have position, bone/matrix index (check the comments) and blending weights
only xy bone/matrix indexes are used and blend 0..1 is used to blend between them

2. Skeleton doesn't have vertexes, only bones. Mesh has vertexes and they have bone indexes which point to bones.
11-27-2010 08:31 PM
Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #17
RE: Low-level questions & high level features
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 pfft ).

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?
11-27-2010 09:13 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #18
RE: Low-level questions & high level features
You're assuming that 2 different meshes have exactly the same set of vertexes and in the same order, while they may not.
11-27-2010 09:20 PM
Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #19
RE: Low-level questions & high level features
Ohhhhhhh. That's good; not such a limitation then. Thanks.

Is 2. correct, or can't I assume that? And any ideas on 3? EDIT: Solved it by bit packing/shifting a UInt to-and-from a VecB4 and using IMAGE_B8G8R8A8.
Cheers.
(This post was last modified: 11-28-2010 11:50 AM by Chris.)
11-27-2010 09:27 PM
Find all posts by this user Quote this message in a reply
Post Reply