Join also our Discord channel! Click here.

Dead or Alive series formats and tools

Post questions about game models here, or help out others!
User avatar
aagems
advanced
Posts: 75
Joined: Wed May 30, 2012 6:07 pm
Has thanked: 6 times
Been thanked: 1 time

Re: Dead or Alive series formats and tools

Post by aagems » Thu Aug 02, 2012 10:16 am

Darko wrote:
aagems wrote:Hi, i just want to know is there any tools to import to 3ds max or model viewer for dead or alive paradise? i know there's a bms script to unpack the container but im confuse what should i do with those already unpacked file. well b0ny maybe you could make it one?? :]

Another question,does this game uses split model files like other doa (DOAU&DOA3)series??
I wonder howcome some guys arrive here without checking the entire forum:

viewtopic.php?f=33&t=7901

DOAP is partially supported by fatduck importer script for 3ds max. It's in a beta phase. I have the bms included in the first update to unpack the .arc file, but I don't know if it's ok to share it right now.
Sorry,my bad.I have that fat importer too.i check it again and yes theres a viewer for doa paradise in that script though its still beta. However,problem solved.Thanks for remind me :]
Great things require hard work!!

User avatar
aagems
advanced
Posts: 75
Joined: Wed May 30, 2012 6:07 pm
Has thanked: 6 times
Been thanked: 1 time

Re: Dead or Alive series formats and tools

Post by aagems » Thu Aug 02, 2012 10:27 am

aagems wrote:any tools to import to 3ds max or model viewer for dead or alive paradise?
some guy here http://git.daifukkat.su/?p=spark.git;a=summary worked for some time on a tool for doap unpacking, you may want to have a look at it.
aagems wrote:Another question,does this game uses split model files like other doa (DOAU&DOA3)series??
frankly, no idea :(

@bony:thanks for the info.youre the man!!
Sorry,wrong typing.not split body model,i mean split body part like those xbox1 doa games [roll]
Great things require hard work!!

b0ny
mega-veteran
mega-veteran
Posts: 239
Joined: Sat May 22, 2010 10:10 am
Has thanked: 22 times
Been thanked: 118 times

Re: Dead or Alive series formats and tools

Post by b0ny » Thu Aug 02, 2012 7:33 pm

sagesau wrote:I'm not sure how you can get poses from the first frame but have difficulty for the rest, but either way if you know something about the animation format, tell me. I might make it myself.
here is a tool for logging all the animation from the mot file to a text file + the source code you can look in. just put it in a folder with a mot file and it will log a full dump of all animations in "mylog2.log"(except for some tricky technique using precalculated sinus values), and just the first frames from each animation in "mylog3.log".
mylog2.log:
1e2c(0) //offset in the mot file (offset of the pointer in the mot header)
#0: //totally, there are 44 animation blocks for each body part, for position and rotation, in each animation chunk
1-34[33] 4(0.0063, -0.000900269, -0.00121307) //frames from "1" to
"34", totally "[33]" frames for this key frame; keyframe type = "4(", 'main value' = "0.0063,", 'specific(unknown) values' for this keframe = " -0.000900269, -0.00121307)"
... 0(-0.0004)$ // "..." means the last frame in this animation block, and the 'main value' = (-0.0004), the end character(debugging) = "$"

in mylog3.log you see the name of the limb and it's global coordinates, the suffix "_xyz" means the position, everything else is rotation:
pelvis_xyz 0, 0.935, 0 //pelvis position x=0, y=0.935, z=0
pelvis 8.89343, 288.578, 339.142 //pelvis rotation(in degrees) x=8.89343, y=288.578, z=339.142


i have a problem - i don't know how to set the global position of a child bone while in pose mode in blender(with the inverse kinematics turned on), i need just to set the global xyz coordinates for the palm or for the foot, but blender is giving me some relative shit, related to the parent bone.

sagesau
n00b
Posts: 11
Joined: Thu Jul 26, 2012 1:53 pm
Been thanked: 2 times

Re: Dead or Alive series formats and tools

Post by sagesau » Thu Aug 02, 2012 9:44 pm

Nice :)
This is going to be interesting...

The Blender docs say PoseBone.matrix is in "world space", so its weird you say it is relative, but Blender docs have always had outdated/wrong info.

If that's really the case, we need to multiply the bone's (PoseBone's) matrix with the inverse of its parent's matrix.
Something like this:

Code: Select all

if poseBone.parent:
    poseBone.matrix = poseBone.matrix * poseBone.parent.matrix.copy().inverted()
Or in opposite order, I'm not sure. We didn't need to do this shit manually in the old API, and I haven't yet written an animation imported for the new Blender.

Also, have you thought of uploading your scripts/tools to googlecode/Sourceforge? The keep them up for like forever.
Just mention in the main page that they are for "research and protected as fair use".

b0ny
mega-veteran
mega-veteran
Posts: 239
Joined: Sat May 22, 2010 10:10 am
Has thanked: 22 times
Been thanked: 118 times

Re: Dead or Alive series formats and tools

Post by b0ny » Fri Aug 03, 2012 10:46 am

sagesau
i don't now what a matrix is, and i don't now how to make a poseBone.matrix having just the global xyz values. i've tried to set the xyz manually just to check if the data i've extracted is correct, but blender has disabled the xyz fields, and only allows me to edit some strange "vector xyz"...

can you give me a guide how to set the location of a child bone 'LeftPalm' to the global xyz coordinates 0,0,0?

THESIERRAMAN wrote:I have DOAX2 ISO (for XBOX 360), but the site where I get it said "nude patch", and I used "Noesis program" for extract the models and I only found the models without costumes ( :cry: )
I found some archives called werone.afs and wertwo.afs, but there are only elements called "archives".
the costumes are in werone.afs and wertwo.afs, but that "nude patch" don't have them. how do you think they made it "nude" ? - they just deleted all the costumes!

sagesau
n00b
Posts: 11
Joined: Thu Jul 26, 2012 1:53 pm
Been thanked: 2 times

Re: Dead or Alive series formats and tools

Post by sagesau » Fri Aug 03, 2012 11:29 am

b0ny wrote:sagesau
i don't now what a matrix is, and i don't now how to make a poseBone.matrix having just the global xyz values. i've tried to set the xyz manually just to check if the data i've extracted is correct, but blender has disabled the xyz fields, and only allows me to edit some strange "vector xyz"...

can you give me a guide how to set the location of a child bone 'LeftPalm' to the global xyz coordinates 0,0,0?
Matrix is something simple that people love to overcomplicate, so I wouldn't suggest googling it as you might get even more confused.

A Matrix is just a table of numbers. A table is like a 2-dimensional Python list.
This is an example matrix:

Code: Select all

[0, 1, 3
4, 5, 6
7, 8, 9]
In computer graphics its used for positioning objects, bones and animating them, and is called a "transformation matrix", or "transform matrix").
A transform matrix holds numbers used for position, rotation and scale. It's usually a 4x4 matrix. bottommost and leftmost values are usually zeroes.

Everyone gets this question the first time: Why is transform matrix used and why is a 4x4 sized one used in 3d graphics, when we can assign the values individually, and make it look less confusing?

The answer is: performance. Multiplying a matrix by vector (x,y,z values) or another matrix is fast for the CPU/GPU.

So if you want to assign the position, rotation and scale at the same time fast, using PoseBone.matrix is fast, and since many 3d files already have the values as matrix (16 floats), its faster for importers.

That said, I'm a noob in matrix math myself.

After you've set the bone's position and rotation, the PoseBone.matrix gets updated automatically by Blender. Try doing this:

Code: Select all

poseBone.matrix = poseBone.matrix * poseBone.parent.matrix.copy().inverted()
I *think* this will work.

You can go to Edit mode, select all bones and press Alt+P to undo parenting and then import the animations, just to make sure everything else works. before we get this sorted out.

b0ny
mega-veteran
mega-veteran
Posts: 239
Joined: Sat May 22, 2010 10:10 am
Has thanked: 22 times
Been thanked: 118 times

Re: Dead or Alive series formats and tools

Post by b0ny » Fri Aug 03, 2012 12:56 pm

sagesau

RightX RightY RightZ 0
UpX UpY UpZ 0
LookX LookY LookZ 0
PosX PosY PosZ 1

i googled matrices. but i don't see how to use them with the animation i extract form mot files. the doa(x,u,3,2) animation data isn't stored in matrices. it have only this:
xyz location for - ass, palms, feets.
rotation for - ass, chest, head, palms, feets.

i'm starting to think that importing animation is much more complicated than i thought before. that thing with the palm positioning that i mentioned before, was all about ik animation and now i'm starting to think that you can't have ik from inside the python, that it only works when you drag the bones with the mouse, and you can't shift from python just the child bone to animate all the parents...

sagesau
n00b
Posts: 11
Joined: Thu Jul 26, 2012 1:53 pm
Been thanked: 2 times

Re: Dead or Alive series formats and tools

Post by sagesau » Fri Aug 03, 2012 1:59 pm

I'm not sure if I got what the problem is.

You say you have position for some bones and position+rotation for others.
Cool.
Assign them like this

Code: Select all

PoseBone.location = [x,y,z]
PoseBone.rotation_euler = [h,p,r]
Blender will update the PoseBone.matrix now. And you can do

Code: Select all

poseBone.matrix = poseBone.matrix * poseBone.parent.matrix.copy().inverted()
Values not set, like scale will have default values ( (1,1,1) for scale and (0,0,0) for position/rotation ), you don't have to fill the rest of the values in the matrix, Blender does that itself.

poseMatrix in Blender 2.4 didn't care about iks, probably new API works the same way, so shouldn't be a problem. I'm not sure if you're using the term "ik" right though, are you talking about Armature hierarchy (parenting), or ik constraints?

Also, do you have a Python reader for the mot files now? I looked at the cpp source of the tool you uploaded, but I don't know C++ to understand what it does.

You're having problem with the Blender API, and I'm having problem with the file reading part. If you would send me some Python code for reading the files or format specification, we could work on the same thing - the Blender part.

BTW, did you check if the values are relative to rest pose (EditBone values) or not? That could make it look wrong too. As well as not converting it from y-up space to Blender's z-up like you did in the model importer.

b0ny
mega-veteran
mega-veteran
Posts: 239
Joined: Sat May 22, 2010 10:10 am
Has thanked: 22 times
Been thanked: 118 times

Re: Dead or Alive series formats and tools

Post by b0ny » Fri Aug 03, 2012 2:43 pm

sagesau
ik = inverse kinematics (it's when you don't need to animate all bones because the pc will do this for you)

this script will log the values to the console

Code: Select all

#mot
import struct

def dw2sign(mydword):#unsigned32 to signed64 int
    return (mydword & 0xffffffff) - (0x100000000 if mydword & 0x80000000 else 0)
    #return struct.unpack("=l", struct.pack("=L", (mydword & 0xffffffff)))[0]

def w2dw(myword):#word to dword
    return (0xffff0000 if myword & 0x8000 else 0) + (myword & 0xffff)

def b2dw(mybyte):#byte to dword
    return (0xffffff00 if mybyte & 0x80 else 0) + (mybyte & 0xff)


def ww2f(kfh):#word+word to float
    return dw2sign((w2dw(kfh[0] & 0xF000) << 4) + kfh[1]) / 10000.0

def bw2f(kfb, kfw):#byte+word to float
    return dw2sign((b2dw(kfb) << 0x10) + kfw) / 1000000.0


with open("C:\\karate.mot", 'rb') as fmot: #change the "C:\\karate.mot" path to the right one
    limbnames = ("pelvis_xyz:\n", "", "", "pelvis:\n", "", "", "chest:\n", "", "", "head:\n", "", "",
    "bpalm_xyz:\n", "," ,"", "bpalm:\n", "", "", "belbow:\n", "bshoulder:\n",
    "fpalm_xyz:\n", "", "", "fpalm:\n", "", "", "felbow:\n", "fshoulder:\n",
    "bfoot_xyz:\n", "", "", "bfoot:\n", "", "", "bheap:\n", "bknee:\n",
    "ffoot_xyz:\n", "", "", "ffoot:\n", "", "", "fheap:\n", "fknee:\n")#b = back(right), f = front(left)
    limbo = [ord(c)-48 for c in "00011111111100011111000111110001111100011111"]#0 = location, 1 = rotation
    animofsets = []
    while(True):
        animofset = struct.unpack("<L", fmot.read(4))[0]
        if animofset == 0: break
        if animofset in animofsets: continue
        animofsets.append(animofset)
    for animofset in animofsets:
        print("%x<%x>"% (animofset, animofsets.index(animofset)))
        fmot.seek(animofset)
        motions = []
        for i in range(44): motions.append(struct.unpack("<L", fmot.read(4))[0])
        motion = 0
        while(motion < 44):
            fmot.seek(motions[motion])
            if motion < 43 and motions[motion] == motions[motion+1]:
                motion += 3
                print("unknown technique: xyz =", struct.unpack("<HHH", fmot.read(6)))
                continue
            print(limbnames[motion], end = "")
            kframe = 1
            while True:
                kfh = struct.unpack("<HH", fmot.read(4)) #keyframe header
                myfloat = ww2f(kfh)
                frame = (kfh[0] >> 2) & 0x3ff
                kfsize = [10, 4, 6, 8][kfh[0] & 3]
                kframe += frame
                if frame == 0:
                    print("%x"% (kframe - frame), "-", "%x"% kframe, "[", "%x"% frame, "]\te(", myfloat, ")$\n", sep = "", end = "")
                    break
                print("%x"% (kframe - frame), "-", "%x"% kframe, "[", "%x"% frame, "]\t", int(kfsize/2), "(", myfloat, sep = "", end = "")
                if kfsize == 10:
                    kfw, kfb = struct.unpack("<HB", fmot.read(3))
                    specificfloat1 = bw2f(kfb, kfw)
                    kfb, kfw = struct.unpack("<BH", fmot.read(3))
                    specificfloat2 = bw2f(kfb, kfw)
                    print(", %.6f, %.6f"% (specificfloat1, specificfloat2), sep = "", end = "")
                elif kfsize == 8:
                    kfww = struct.unpack("<HH", fmot.read(4))
                    print(", %.6f, %.6f"% ((dw2sign(w2dw(kfww[0])) * (0.5**17)), (dw2sign(w2dw(kfww[1])) * (0.5**17))), sep = "", end = "")
                elif kfsize == 6:
                    kfw = struct.unpack("<H", fmot.read(2))[0]
                    print(", %.6f"% (dw2sign(w2dw(kfw)) * (0.5**17)), sep = "", end = "")
                if(limbo[motion]):print(")\t[%.2f°]"% (myfloat * 54.931640625), sep = "")
                else:print(")")
            print("")
            motion += 1 #increment the motion here
        print("[!]\n")
        break# remove this to log the whole *.mot
Last edited by b0ny on Fri Aug 03, 2012 2:50 pm, edited 1 time in total.

sagesau
n00b
Posts: 11
Joined: Thu Jul 26, 2012 1:53 pm
Been thanked: 2 times

Re: Dead or Alive series formats and tools

Post by sagesau » Fri Aug 03, 2012 2:47 pm

b0ny wrote:sagesau
ik = inverse kinematics (it's when you don't need to animate all bones because the pc will do this for you)
PC does a lot of things for you. What do you mean exactly? Parent bones moving their children with them is not IK yet. IK is more complicated and is achieved in Blender with constraints. Is that what you mean, or just bone parenting?

And thanks.

b0ny
mega-veteran
mega-veteran
Posts: 239
Joined: Sat May 22, 2010 10:10 am
Has thanked: 22 times
Been thanked: 118 times

Re: Dead or Alive series formats and tools

Post by b0ny » Fri Aug 03, 2012 2:51 pm

sagesau wrote:
b0ny wrote:sagesau
ik = inverse kinematics (it's when you don't need to animate all bones because the pc will do this for you)
PC does a lot of things for you. What do you mean exactly? Parent bones moving their children with them is not IK yet. IK is more complicated and is achieved in Blender with constraints. Is that what you mean, or just bone parenting?

And thanks.
i mean children moving all their parents

sagesau
n00b
Posts: 11
Joined: Thu Jul 26, 2012 1:53 pm
Been thanked: 2 times

Re: Dead or Alive series formats and tools

Post by sagesau » Fri Aug 03, 2012 3:00 pm

Children moving their parents or parents moving their children? Sorry, small typo can change it all.

b0ny
mega-veteran
mega-veteran
Posts: 239
Joined: Sat May 22, 2010 10:10 am
Has thanked: 22 times
Been thanked: 118 times

Re: Dead or Alive series formats and tools

Post by b0ny » Fri Aug 03, 2012 7:05 pm

sagesau wrote:Children moving their parents or parents moving their children? Sorry, small typo can change it all.
Children moving their parents

direct kinematics is when you pose the root first, then you can only rotate the children following down the hierarchy.
inverse kinematics is when you don't care about the parents, you just move the children, and the inverse kinematic will take care of the parent bones calculating their positions and angles for the whole hierarchy up to the root.

i don't think that doa has some kind of unique animation technique. i should have a look in scripts for importing animation in blender. for sure, i'll find something similar to this. from what i remembered today about ik animation some empty gizmos should be created, and the bones should be attached to them, and when you move the empties, the bones are following them, this way you don't need to care about matrices and stuff.

sagesau
n00b
Posts: 11
Joined: Thu Jul 26, 2012 1:53 pm
Been thanked: 2 times

Re: Dead or Alive series formats and tools

Post by sagesau » Fri Aug 03, 2012 11:06 pm

Are you saying ik data is stored in the xprs/cats? Otherwise I'll suggest against creating ik constraints in the importer. I don't know of any importer that does that. That's something the users should set for their own specific needs, or as a separate addon.

Either way, the matrix, or individual location and rotation_euler values you assign to PoseBones are the transform of the PoseBone "after all the constraints have been applied", so it shouldn't be a problem.

sagesau
n00b
Posts: 11
Joined: Thu Jul 26, 2012 1:53 pm
Been thanked: 2 times

Re: Dead or Alive series formats and tools

Post by sagesau » Sun Aug 05, 2012 10:04 am

OK, I got Python 3 and tried your script.
I still don't understand what I'm seeing.
Can you explain what this means?

Code: Select all

fpalm:
1-14[13]        5(0.0333, 0.000010, 0.002602)   [1.83°]
14-1f[b]        5(-0.0112, 0.002447, 0.003410)  [-0.62°]
1f-24[5]        5(0.038, 0.003654, 0.009342)    [2.09°]
24-29[5]        5(0.0633, 0.010217, 0.000501)   [3.48°]
29-41[18]       5(0.1151, 0.000503, -0.002135)  [6.32°]
41-50[f]        5(0.0728, -0.002135, -0.000158) [4.00°]
50-50[0]        e(0.0314)$
The code isn't self-explanatory either.

I don't know what "keyframe header" is, "myfloat", "frame", "kfsize", and why you add frame to kframe.
Neither what the code does depending on the "kframe" size.

I'm not a professional programmer, but I'm not a noob either. Please explain the code if you want help.

Post Reply