Pages: [1]
  Print  
Author Topic: help with aligning tags/frames  (Read 9634 times)
coffeeaddict
Nub


Cakes 0
Posts: 3


« on: September 07, 2015, 09:47:16 PM »

I've been writing some code in python to read md3 files and push each frame to a wavefront obj. Most of my info came from the wikipedia article. I have some questions regarding animation.cfg, frames and tags.

I have parsed the "grism" (generic marine soldier guy) set of models (lower, torso, head) as a test case.

1. There are 213 lower frames, 155 torso frames and 1 head frame in 'grism'. This does not make much sense without an offset after looking at animation.cfg...can someone tell me the offsets for the two frame sets (leaving 'head' out because there is only 1 frame for it)? Technically should any 'lower' match with any 'upper', head, and weapon, and so-forth match?

2. I loaded the lower, torso and head. Then I translated the torso/head with the tag origin from the tag data in the 'lower' frame, then rotated the torso on its individual axis from the tag data in the 'lower' frame. Then I translated the head with the tag in the 'torso' frame and then rotated it on its own axis from tag data in the 'torso' frame. Things seem to line up OK this way. Is that sequence correct?

3. I made a random guess (lower frame 101, upper 81 and head 1) and ended up with the attached screen shot using a 3d modeler called DeleD. Does this look on track (translation and rotation with the tag data)?
Logged
revanic
VIP
Half-Nub


Cakes 4
Posts: 67


« Reply #1 on: September 08, 2015, 07:35:51 AM »

In the quake 3 source, you can find how the offset is determined in the animation.cfg parser. However, the offset is dynamic. With quake 3 models, the only frames that the upper and lower body synch up to are the BOTH_DEATH1-3 animations and should have the same amount of frames for them. After that, the lower body and upper body go on to do their own thing.

Quote
Technically should any 'lower' match with any 'upper', head, and weapon, and so-forth match?
Not with the way MD3 animations are handled. Besides, if the lower/upper body contained the same frames for the upper/lower body's specific animations, the file size would be bigger and take a bit longer to load. What you've said is only true in a single skeletal animation based model.
Logged
coffeeaddict
Nub


Cakes 0
Posts: 3


« Reply #2 on: September 09, 2015, 10:23:34 PM »

Thanks for the pointers. Found the section of the code and it helped me understand the animation.cfg file.

Unfortunately I can't seem to get rotation of the head mesh correct using the tags. The 'lower' lines up with the 'upper' OK but the head does not even look attached in most cases. I have been using the matrix defined in TAG_AXIS to get euler angles and rotating using that to rotate the head (X: 9.66345501028 Y: -37.4601316999 Z: -24.113801494). Am I right in translating with TAG_ORIGIN after that (0.6430724859237671, -0.5033272504806519, 15.88720703125)?

It doesn't seem to work. Having trouble finding where I am going wrong here. Help would be appreciated.

Sample...
o C:/Users/John/Desktop/slush/q3/testfolder/upper.md3
# FRAME NAME frame_134
# FRAME LOCAL ORIGIN (0.0, 0.0, 0.0)
# TAG NAME tag_head
# TAG ORIGIN (0.6430724859237671, -0.5033272504806519, 15.88720703125)
# TAG AXIS [0.7245085835456848, -0.32429781556129456, 0.6082091331481934]
# TAG AXIS [0.3095681667327881, 0.9414954781532288, 0.1332438439130783]
# TAG AXIS [-0.6158370971679688, 0.09174603223800659, 0.7825134992599487]
# TAG AXIS X: 9.66345501028 Y: -37.4601316999 Z: -24.113801494
# TAG NAME tag_weapon
# TAG ORIGIN (13.683149337768555, -5.44180154800415, 1.490789532661438)
# TAG AXIS [1.0462006330490112, 0.6163755655288696, -0.7222790122032166]
# TAG AXIS [-0.8750594854354858, 1.0430785417556763, -0.3773595690727234]
# TAG AXIS [0.3686160147190094, 0.7267804145812988, 1.1541461944580078]
# TAG AXIS X: -18.1056711075 Y: 30.745252287 Z: 30.5047281778
Logged
Suicizer
Member
Member
*

Cakes 2
Posts: 402


WWW
« Reply #3 on: September 10, 2015, 12:07:05 AM »

Is .obj actually supporting tags in it's use?
Logged

I'm good at everything but can't do anything...
coffeeaddict
Nub


Cakes 0
Posts: 3


« Reply #4 on: September 10, 2015, 05:09:09 AM »

No. I wrote a python script that looks at a given folder for md3 files...then reads each md3 and creates a wavefront obj for every frame an md3 has. My python script puts the tag data in comments (hence '#'). I've been importing them into a 3d modeling program and manually rotating and translating them in a effort to understand exactly how they are supposed to work before writing code to automate it. Eventual goal is to use them with panda3d but need to know what I'm doing first.
Logged
Pages: [1]
  Print  
 
Jump to: