Giter Club home page Giter Club logo

Comments (10)

zturtleman avatar zturtleman commented on June 3, 2024

Could you email me the model to use for debugging this? (see email on my github profile) I haven't managed to create a working IQM.

from spearmint.

zturtleman avatar zturtleman commented on June 3, 2024

I've confirmed that R_LerpTag for IQM returns the wrong information. It returns the "pose" for joint, instead of the joint information. Issue applies to ioquake3 as well.

from spearmint.

aisouard avatar aisouard commented on June 3, 2024

Great ! I was wondering if it was coming from the IQM exporter.
I'll try to do what I can to solve that. Thanks for the hint !

On Fri, Mar 8, 2013 at 5:23 AM, Zack Middleton [email protected]:

I've confirmed that R_LerpTag for IQM returns the wrong information. It
returns the "pose" for joint, instead of the joint information. Issue
applies to ioquake3 as well.


Reply to this email directly or view it on GitHubhttps://github.com//issues/11#issuecomment-14602128
.

from spearmint.

zturtleman avatar zturtleman commented on June 3, 2024

pose joint information is used to modify vertex positions for each frame,
the joint information is only included for unanimated position. I haven't
figured out how to get animated joint origin/axis at a frame. Hmm, what if
use joint matrix and multiply/add by pose matrix (like done for vertex
positions)? I'll try that later.
On Mar 8, 2013 7:39 AM, "Axel Isouard" [email protected] wrote:

Great ! I was wondering if it was coming from the IQM exporter.
I'll try to do what I can to solve that. Thanks for the hint !

On Fri, Mar 8, 2013 at 5:23 AM, Zack Middleton [email protected]:

I've confirmed that R_LerpTag for IQM returns the wrong information. It
returns the "pose" for joint, instead of the joint information. Issue
applies to ioquake3 as well.


Reply to this email directly or view it on GitHub<
https://github.com/zturtleman/spearmint/issues/11#issuecomment-14602128>
.


Reply to this email directly or view it on GitHub.

from spearmint.

aisouard avatar aisouard commented on June 3, 2024

I'm working on it and maybe getting something, I've stored every joint matrices in memory, then doing this right after the end of the ComputeJointMats function (a copy of ComputePoseMats).

for( i = 0; i < data->num_joints; i++ ) {
    float outmat[12];
    mat1 = mat + 12 * i;
    Matrix34Invert(mat1, outmat);
    Matrix34Multiply( data->jointMats + 12 * (2 * i),
        outmat, mat + 12 * i );
}

I'm getting this so far if I invert the pose matrice (the sword moves anormally in the Idle pose) : http://youtu.be/tcphImXf-VU
When I don't invert it, and multiply the joint matrice directly with the pose's : http://youtu.be/k2y2CZtzNJA

Do you have any idea ? I'm still trying some random stuff at the moment.
Here is my diff : http://pastebin.com/AC8LnRnx

from spearmint.

aisouard avatar aisouard commented on June 3, 2024

It seems to be more correct when I add the matrix instead of multiplying it.
The sword is perfectly stickied to the hand but still in the wrong direction. ( http://youtu.be/peOngNKValc )

static void Matrix34Add( float *a, float *b, float *out ) {
    out[ 0] = a[ 0] + b[ 0];
    out[ 1] = a[ 1] + b[ 1];
    out[ 2] = a[ 2] + b[ 2];
    out[ 3] = a[ 3] + b[ 3];
    out[ 4] = a[ 4] + b[ 4];
    out[ 5] = a[ 5] + b[ 5];
    out[ 6] = a[ 6] + b[ 6];
    out[ 7] = a[ 7] + b[ 7];
    out[ 8] = a[ 8] + b[ 8];
    out[ 9] = a[ 9] + b[ 9];
    out[10] = a[10] + b[10];
    out[11] = a[11] + b[11];
}

// inside the ComputeJointMats function
for( i = 0; i < data->num_joints; i++ )
    Matrix34Add( data->jointMats + 12 * (2 * i), mat + 12 * i, mat + 12 * i );

from spearmint.

zturtleman avatar zturtleman commented on June 3, 2024

This seems to be working, after I finally realized my cgame code was making the axis wrong. Have swords in hands and with correct rotation.

static void Matrix34Multiply_OriginOnly( float *a, float *b, float *out ) {
    out[ 3] = a[0] * b[3] + a[1] * b[7] + a[ 2] * b[11] + a[ 3];
    out[ 7] = a[4] * b[3] + a[5] * b[7] + a[ 6] * b[11] + a[ 7];
    out[11] = a[8] * b[3] + a[9] * b[7] + a[10] * b[11] + a[11];
}

static void ComputeJointMats( iqmData_t *data, int frame, int oldframe,
                  float backlerp, float *mat ) {
    float   *mat1;
    int i;

    ComputePoseMats( data, frame, oldframe, backlerp, mat );

    for( i = 0; i < data->num_joints; i++ ) {
        float outmat[12];
        mat1 = mat + 12 * i;

        Com_Memcpy(outmat, mat1, sizeof(outmat));

        Matrix34Multiply_OriginOnly( outmat, data->jointMats + 12 * 2 * i, mat1 );
    }
}

Going to clean it up soon.

from spearmint.

zturtleman avatar zturtleman commented on June 3, 2024

ioq3 commit: ioquake/ioq3@8aa6efe

It's merged into Spearmint as well.

Let me know if it's works for you or not.

from spearmint.

aisouard avatar aisouard commented on June 3, 2024

Awesome !
I should rotate the sword correctly and it will be perfect.

Thanks a lot !

from spearmint.

zturtleman avatar zturtleman commented on June 3, 2024

Just to clarify, my issue with rotation was that I was placing sword on legs model twice (so it rotated double and would spin when player model rotated).

something like

CG_PositionRotatedEntityOnTag( &torso, &legs, legs.hModel, "Waist");
//disabled rendering torso
...
torso.hModel = swordModel;
CG_PositionRotatedEntityOnTag( &torso, &legs, legs.hModel, "Handle.R");
//render sword

I figured it out when I added second sword, which spun twice as fast as the first while turning. Doing AxisClear ( torso.axis ); before CG_PositionRotatedEntityOnTag solved the issue.

from spearmint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.