Share

MD5 Reader 2

Tracker: Bugs

5 Model shaking/twitching - ID: 1698985
Last Update: Comment added ( ender_saka )

As reported on this thread:
http://www.jmonkeyengine.com/jmeforum/index.php?topic=4709.0 it seems that
the marine model « ... is twitching from side to side, mostly vertically
though. ... ».

In another thread,
http://www.jmonkeyengine.com/jmeforum/index.php?topic=4858.0 , someone
fixed the problem, creating an origin bone.

Also read this tutorial,
http://www.jmonkeyengine.com/wiki/doku.php?id=exporting_animated_.md5_model
s_from_blender , in the jME wiki, that demonstrates how to use origin
bone.

NOTE: the post was published in March 13, 2007. The CVS version of jME used
to test MD5 Reader 2 is 5 months old.


ender_saka ( ender_saka ) - 2007-04-12 07:41

5

Closed

Out of Date

ender_saka

Animation

CVS

Public


Comments ( 5 )

Date: 2009-08-04 04:27
Sender: ender_sakaProject Admin

This was a MD5 Reader 2 bug. Newer MD5 Reader 2 Refactor (see SVN branches)
resolved this problem.


Date: 2007-08-08 15:31
Sender: ender_sakaProject Admin


Ok I made a fix to the fix.

Accordingly to http://tfc.duke.free.fr/coding/md5-specs-en.html I should
replace a base transformation component (xt, yt, zt, xr, yr, zr) with frame
transformation component only if component's flag is setted. For a child
bone I should also convert its transformation quaternion to local
coordinates, multiplying it by its parent transformation quaternion.

But it seems that child bones are already in local coordinates (at the
position of the previous fix). So, I just have to replace components for
either the parent bone and child bones.

The only difference is that, for some unexplainable reason, parent bone's
x-axis and z-axis are flipped, making the parent bone of the marine model
to strafe left, instead of forward.

So I simply inverted the x and z coordinates when assigning parent bone
transformations at the end of the md5reader.MD5AnimReader.loadFrame()
method.

example:
frame.positions[it] = new Vector3f(tz, ty, tx);

And now everything seem to work. I hope :-D !


Date: 2007-08-08 14:19
Sender: ender_sakaProject Admin


It seems that I have been able to fix this bug.
It have been uploaded in CVS repository.

The problem seems to be caused by redundant instructions at line 201 and
209 of the md5reader.MD5AnimReader.java source file. Now the lines are
comented out.

Take a look here:

// Commented by Marco Frisan 8 ago 2007 - fix to model shaking/twitching
//if (parents[i] < 0)
// BASE.multLocal(frame.positions[it - 1]);

// Commented by Marco Frisan 8 ago 2007 - fix to model shaking/twitching
//if (parents[i] < 0)
// BASE.multLocal(frame.rotations[ir - 1]);

Furthermore it seems that there are some not needed methods, called some
lines above in the same source file (line 113).

// Commented by Marco Frisan 8 ago 2007 - fix to model shaking/twitching
// These calls are not any more needed.
//AnimationUtils.cleanUnusedFrames(animation, 0.00003f);
//animation.recalculateMovementRotation(0);
//animation.recalculateMovementTranslation(0);

In particular, cleanUnusedFrames() method seems to be a workaround more
than a needed code.
I used http://tfc.duke.free.fr/coding/md5-specs-en.html resource to help
in debug the code. And the author does not mention anywhere the need for
cleaning unused frames.

That resource helped me also to understand the above redundant
instructions. Whit the sentence « If a bit is set, then you have to
replace the corresponding (x, y, z) component by a value from the frame's
data. » I understood that everything was needed to do is already done.

Even if, there is a code in the resource example code that probably should
be implemented to make parent bone working. In fact, I think that with the
code currently commented out any parent bone animation is skiped.

/* has parent? */
if (thisJoint->parent < 0)
{
memcpy (thisJoint->pos, animatedPos, sizeof (vec3_t));
memcpy (thisJoint->orient, animatedOrient, sizeof (quat4_t));
}
else
{
md5_joint_t *parentJoint = &skelFrame[parent];
vec3_t rpos; /* rotated position */

/* add positions */
Quat_rotatePoint (parentJoint->orient, animatedPos, rpos);
thisJoint->pos[0] = rpos[0] + parentJoint->pos[0];
thisJoint->pos[1] = rpos[1] + parentJoint->pos[1];
thisJoint->pos[2] = rpos[2] + parentJoint->pos[2];

/* concatenate rotations */
Quat_multQuat(parentJoint->orient, animatedOrient,
thisJoint->orient);
Quat_normalize (thisJoint->orient);
}


Date: 2007-04-30 19:36
Sender: ender_sakaProject Admin


I decided to reopen this bug tracker. I tested the bike animation with
another loader (Doom 3's MD5 Viewer at http://tfc.duke.free.fr/, you can
download it at http://tfc.duke.free.fr/old/models/md5loader-09.tar.bz2)
written in C++ and it works.


Date: 2007-04-25 20:57
Sender: ender_sakaProject Admin


I am sorry. I misunderstood the jME forum post about this bug. The
MD5Test2.java runs the fish model/anim and not the marine model.

Anyway I am still unable to view the avi linked by Orihara in his post.
And I do not get any animation twitching or texture twitching.

Moreover I tested the marine walk animation with latest jME CVS and jME
0.11 without problems.

I think that the cause of all this problems, for now, would be bad models
setup and/or exporting.


Attached File

No Files Currently Attached

Changes ( 13 )

Field Old Value Date By
status_id Open 2009-08-04 04:27 ender_saka
resolution_id Fixed 2009-08-04 04:27 ender_saka
close_date - 2009-08-04 04:27 ender_saka
allow_comments 1 2009-08-04 04:27 ender_saka
resolution_id None 2007-08-08 14:19 ender_saka
summary Md5 twitching 2007-08-08 14:19 ender_saka
close_date 2007-04-25 20:57 2007-04-30 19:36 ender_saka
status_id Closed 2007-04-30 19:36 ender_saka
resolution_id Works For Me 2007-04-30 19:36 ender_saka
close_date - 2007-04-25 20:57 ender_saka
resolution_id None 2007-04-25 20:57 ender_saka
status_id Open 2007-04-25 20:57 ender_saka
assigned_to nobody 2007-04-12 07:43 ender_saka