READ THE RULES: Click here

Follow us on Facebook: https://www.facebook.com/xentax/ :)

Pokemon Battle Revolution Bones [Problem]

Post questions about game models here, or help out others!
gregkwaste
advanced
Posts: 69
Joined: Tue Apr 15, 2014 10:17 pm
Has thanked: 2 times
Been thanked: 8 times

Pokemon Battle Revolution Bones [Problem]

Post by gregkwaste » Tue Apr 15, 2014 11:05 pm

Howdy everyone.

At the moment i am working on an importer for the Pokemon Battle Revolution game of 2007 (in Blender of course).

I had no problems with the model information, nor with the textures. What i am struggling with though are the bones.

All the sections contained in the file are defined in blocks and they are starting with some kind of id which i use for now to distinguish the sections for the models and the bone sections. Now for those bone sections there is a 3 float value contained which is probably the bone tail position and some offsets which lead to the children and sibling bones. In some sections there are some matrices contained in the sections but i can't figure out how to use them. I tried to apply them by multiplying it with the bone tail, but the result was literally shit :P There is also another 3 float rotation defined which i also tried to apply on the bone tails and it seems like a rotation leading to a posing stance.

So what i am thinking in the end is that i don't need neither the matrix nor the rotation, to simply visualize the bones in their default stance to match the model skin. There are still problems though. The closest i managed to get is here:

Image

I can't figure out why the heck the legs and the arms are aligned like this, while the tail is in its place.
This is happening with other models as well. None of them gets its bones correctly aligned.

What has possibly gone wrong? Is there anything i am missing?
Last edited by gregkwaste on Tue Apr 22, 2014 8:17 pm, edited 1 time in total.

gregkwaste
advanced
Posts: 69
Joined: Tue Apr 15, 2014 10:17 pm
Has thanked: 2 times
Been thanked: 8 times

Re: Pokemon Battle Revolution Bones

Post by gregkwaste » Thu Apr 17, 2014 10:23 pm

Update: I played around with some more models, and one of them got imported correctly
Image

I can't explain why it is not working with the rest :S:S

Any clue about bone investigation in game models is highly appreciated.

gregkwaste
advanced
Posts: 69
Joined: Tue Apr 15, 2014 10:17 pm
Has thanked: 2 times
Been thanked: 8 times

Re: Pokemon Battle Revolution Bones

Post by gregkwaste » Sun Apr 20, 2014 1:43 pm

*bump* anyone???

gregkwaste
advanced
Posts: 69
Joined: Tue Apr 15, 2014 10:17 pm
Has thanked: 2 times
Been thanked: 8 times

Re: Pokemon Battle Revolution Bones

Post by gregkwaste » Tue Apr 22, 2014 7:43 pm

I think i need to generalize the question in order to get some opinions, so i want to know is:

Is there any possibility that the bone matrices and rotations i've found should be used in order to calculate the default bone position? For what i've searched so far, i see that the matrices are used in order to apply an animation or a specific pose. Could it be that the default bone position is thought as a special pose?


Please guys, i'm getting really desperate for some help. I'm totally stuck.

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2733
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 675 times
Been thanked: 1408 times

Re: Pokemon Battle Revolution Bones [Problem]

Post by shakotay2 » Tue Apr 22, 2014 8:29 pm

Guess without samples and without the script noone will dig into this.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

gregkwaste
advanced
Posts: 69
Joined: Tue Apr 15, 2014 10:17 pm
Has thanked: 2 times
Been thanked: 8 times

Re: Pokemon Battle Revolution Bones [Problem]

Post by gregkwaste » Tue Apr 22, 2014 9:39 pm

shakotay2 wrote:Guess without samples and without the script noone will dig into this.
Sorry for that :P

So here is some more info about it

first of all a typical bone header:
Image

And my python code:

Code: Select all

#Draw Bones
    bpy.ops.object.add(type='ARMATURE',enter_editmode=True,location=(0,0,0))
    ob=bpy.context.object
    ob.name=pokemon_name
    amt = ob.data
    amt.name = pokemon_name+'Amt'
    #amt.show_axes = True
    print('Importing '+str(len(bone_positions_vectors)) +' Bones')
    
    for i in range(len(bone_positions_vectors)):
        bpy.ops.object.mode_set(mode='EDIT')
        bone=amt.edit_bones.new(bone_positions_names[i])
        bone.use_local_location=True
        bone.use_inherit_rotation=True
        bone.tail=Vector(bone_positions_vectors[i])
        mat=bone_positions_matrices[i]    
        
        if bone_positions_parents[i] in amt.edit_bones:
            
            #mat=bone_positions_matrices[bone_positions_parents.index(bone_positions_parents[i])]
            #bone_positions_matrices[i]=mat*bone_positions_matrices[i]
            parent=amt.edit_bones[bone_positions_parents[i]]
            bone.parent=parent
            bone.head=parent.tail
            bone.use_connect=True
        else:
            bone.head=Vector((0,0,0))
            
        
        bone.tail=bone.head+bone.tail
        
        #Final Check
        if bone.tail==bone.head:
            bone.tail+=Vector((0,0,0.1))
        
        bpy.ops.object.mode_set(mode='OBJECT')
If there is something more needed please tell me so that i can provide it :)

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2733
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 675 times
Been thanked: 1408 times

Re: Pokemon Battle Revolution Bones [Problem]

Post by shakotay2 » Wed Apr 23, 2014 10:12 am

the model file which is imported correctly and one or two model samples which are not would be required.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

gregkwaste
advanced
Posts: 69
Joined: Tue Apr 15, 2014 10:17 pm
Has thanked: 2 times
Been thanked: 8 times

Re: Pokemon Battle Revolution Bones [Problem]

Post by gregkwaste » Wed Apr 23, 2014 10:46 am

shakotay2 wrote:the model file which is imported correctly and one or two model samples which are not would be required.
Okay
So this is mew which is imported correctly...
https://www.dropbox.com/s/5zhedpnsd0qauw6/150_test_0
This is mewtwo which sucks...
https://www.dropbox.com/s/hwbhiim3b4l5nx3/151_test_0

This is a stripped version of the script that imports the bones to the scene. I've just stripped off the model and texture imports. Its much faster as well.
https://www.dropbox.com/s/rnw4x22bqj6tw ... n_bones.py

With a bit tweaking on the script you can print the bone header offsets, for further investigation of the file. If you are not comfortable with that tell me and i'll fix it for you :)


Unfortunately i don't know any other model whose bones are ok, but i can provide you a lot that do not get imported correctly :P

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2733
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 675 times
Been thanked: 1408 times

Re: Pokemon Battle Revolution Bones [Problem]

Post by shakotay2 » Wed Apr 23, 2014 11:31 am

Seems it's 151_test_0 which is imported correctly, isn't it?

Thanx for sharing. Since I'm a "bones apprentice" I'm not sure whether I can help
but I'll try my very best. :)

From a first glance on 150_test_0 I would guess it's a problem with trigonometric functions
(0° instead of 180° or vice versa which should be related to a 'minus' in matrix operations).

If you don't mind could you upload a picture of this model to get a clue how the bones should be orientated?
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

gregkwaste
advanced
Posts: 69
Joined: Tue Apr 15, 2014 10:17 pm
Has thanked: 2 times
Been thanked: 8 times

Re: Pokemon Battle Revolution Bones [Problem]

Post by gregkwaste » Wed Apr 23, 2014 12:13 pm

shakotay2 wrote:Seems it's 151_test_0 which is imported correctly, isn't it?

Thanx for sharing. Since I'm a "bones apprentice" I'm not sure whether I can help
but I'll try my very best. :)

From a first glance on 150_test_0 I would guess it's a problem with trigonometric functions
(0° instead of 180° or vice versa which should be related to a 'minus' in matrix operations).

If you don't mind could you upload a picture of this model to get a clue how the bones should be orientated?

Yes i made a mistake with the names. 151_test_0 is mew and 150_test_0 is mewtwo.

Thanks a lot for your help :D:D I am a bones apprentice's apprentice so you probably know much more than i do, so your help is more than important.

Now for the pics, you can see them on the first two posts, these are the models. If its not that clear i can send you a blend file containing both models.

As for the actual problem, it is probably something like that, but the difficult part for me is to differentiate the bone headers. If it is something like a minus one that should be multiplied with the matrix components, where the heck is it defined, or set?

Also keep in mind that the vertices are in a -X Z Y format. I've made various experimentations so please check the parts where the matrices and the locations are saved for the applied axis order.

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2733
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 675 times
Been thanked: 1408 times

Re: Pokemon Battle Revolution Bones [Problem]

Post by shakotay2 » Wed Apr 23, 2014 1:29 pm

gregkwaste wrote:I am a bones apprentice's apprentice
Are you kidding? From what I see in your script, you're not.
so you probably know much more than i do
Maybe I understand 33% of your script...
Now for the pics, you can see them on the first two posts, these are the models.
Ah, ok, well, the "shadows". Seems my monitor's brightness (50%) is too low.
As for the actual problem, it is probably something like that, but the difficult part for me is to differentiate the bone headers. If it is something like a minus one that should be multiplied with the matrix components, where the heck is it defined, or set?
I would try to narrow down the problem to bone groups that seem to be correct (right arm for example) versa those that are not (right leg for ex.)

So there's obviously an additional 90° rotation
between upLegR - legR
and footR - toeR.

Atm I don't know how to apply a 90°s rotation to a single bone by script.
(All I achieved was turning a whole skeleton.)
wrong_bones.jpg
You do not have the required permissions to view the files attached to this post.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

gregkwaste
advanced
Posts: 69
Joined: Tue Apr 15, 2014 10:17 pm
Has thanked: 2 times
Been thanked: 8 times

Re: Pokemon Battle Revolution Bones [Problem]

Post by gregkwaste » Wed Apr 23, 2014 1:52 pm

shakotay2 wrote:
gregkwaste wrote:I am a bones apprentice's apprentice
Are you kidding? From what I see in your script, you're not.
Screw the script, this script is based on another one i found on blender artists, that introduced me on how blender controls the bones, the rest is just my way of importing the bones.

Feel free to ask me if you have any questions on any part of the script because its normal that you don't understand other sections. (Like the get_children function, this function is just the best function i've written :P)

shakotay2 wrote:
so you probably know much more than i do
Maybe I understand 33% of your script...
I may know how to write scripts but i have no idea about bones and stuff like that, that's why i asked for help, i do not know what i should expect to find in the file, and more important i don't know how to apply it.

As for the actual problem, it is probably something like that, but the difficult part for me is to differentiate the bone headers. If it is something like a minus one that should be multiplied with the matrix components, where the heck is it defined, or set?
I would try to narrow down the problem to bone groups that seem to be correct (right arm for example) versa those that are not (right leg for ex.)

So there's obviously an additional 90° rotation
between upLegR - legR
and footR - toeR.

Atm I don't know how to apply a 90°s rotation to a single bone by script.
(All I achieved was turning a whole skeleton.)
wrong_bones.jpg

first of all the bone parent is fixed, so you don't need to mess around with it. It draws its position from the parent or the 0,0,0 so you want to play with the tail.

Now in order to rotate the bone.tail, you can do it in various ways.
The easiest one is using Vectors rotate function. Bone.tail is a vector type. So i expect that by writing bone.tail.rotate(euler object). I assume that you know how to create an Euler object.

Its very easy:

Code: Select all

eu=Euler()
eu.x,y,z= radian rotation
or all in one eu.rotate_axis('X' or 'Y' or 'Z',radians)
Btw those bones whose names start with ef or ct, should be different from the others. I don't know what could they be, joints? clusters? I have no idea. The only thing i can tell you is that those bones headers have a section id equal to 0x0 rather than the 0x2 of the rest of the bones.

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2733
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 675 times
Been thanked: 1408 times

Re: Pokemon Battle Revolution Bones [Problem]

Post by shakotay2 » Wed Apr 23, 2014 3:06 pm

gregkwaste wrote:Its very easy:

Code: Select all

eu=Euler()
eu.x,y,z= radian rotation
or all in one eu.rotate_axis('X' or 'Y' or 'Z',radians)
Thx - long forgotten memories arise...
In the
for i in range(len(bone_positions_vectors)):
loop I tried
if i==51: bone.tail.rotate(eul)
but seems it's not the index for legR.
Also I've to hide dozens of bones manually again to get a better overview.
Have to think about it tomorrow.
(Doing the 90° z-rotation manually via the blender gui worked.)
Btw those bones whose names start with ef or ct, should be different from the others. I don't know what could they be, joints? clusters? I have no idea.
Me, too. But with some luck we can ignore them so far.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

gregkwaste
advanced
Posts: 69
Joined: Tue Apr 15, 2014 10:17 pm
Has thanked: 2 times
Been thanked: 8 times

Re: Pokemon Battle Revolution Bones [Problem]

Post by gregkwaste » Wed Apr 23, 2014 3:19 pm

shakotay2 wrote:
gregkwaste wrote:Its very easy:

Code: Select all

eu=Euler()
eu.x,y,z= radian rotation
or all in one eu.rotate_axis('X' or 'Y' or 'Z',radians)
Thx - long forgotten memories arise...
In the
for i in range(len(bone_positions_vectors)):
loop I tried
if i==51: bone.tail.rotate(eul)
but seems it's not the index for legR.
Also I've to hide dozens of bones manually again to get a better overview.
Have to think about it tomorrow.
(Doing the 90° z-rotation manually via the blender gui worked.)
Btw those bones whose names start with ef or ct, should be different from the others. I don't know what could they be, joints? clusters? I have no idea.
Me, too. But with some luck we can ignore them so far.

Its really difficult to get the correct id manually, you better use this:

if bone.name=='legR'

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2733
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 675 times
Been thanked: 1408 times

Re: Pokemon Battle Revolution Bones [Problem]

Post by shakotay2 » Thu Apr 24, 2014 3:48 pm

Thx - though it doesn't seem to make sense trying to correct the rotations manually.

In your opening post you wrote "There is also another 3 float rotation defined".
(I supposed them to be angles in radians and converted them into degrees.)
Shouldn't the values be identical or mirrored for left/right leg for example?
As is for 151_test but not for 150_test:

150_test
upLegL 3.5557192153936525 -55.68430907653912 -88.53523428602308
upLegR -0.728983155268552 16.08990565610301 -80.32057943162708

151_test
leg_b 0.47448000814926894 39.99999883637168 0.12653000142642667
leg_bb 0.47448000814926894 -39.99999883637168 0.0
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

Post Reply