Offtopic: Into Commodore 64 (6502) coding, pixeling or music?
Xentax is looking for new members for the !
Just drop us a message at forum@xentax.com and join the Scene Team!

## League of legends model problems....

Post questions about game models here, or help out others!
fatduck
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 93 times

### Re: League of legends model problems....

Got it!
Indeed, it is using that 15-bit nonsense format:

assume those 3-15-15-15 value are axisflag s2 s1 s0

Code: Select all

``````  s0 = 1.41421*(s0-0x3FFF)/0x7FFF
s1 = 1.41421*(s1-0x3FFF)/0x7FFF
s2 = 1.41421*(s2-0x3FFF)/0x7FFF
s3 = sqrt(1-(s0^2+s1^2+s2^2))

case AxisFlg of (
3: return (quat s2 s1 s0 s3)
2: return (quat s2 s1 s3 s0)
1: return (quat s2 s3 s1 s0)
0: return (quat s3 s2 s1 s0)
)--end case``````
No more Fatduck, no more FatImporter, Byebye everyone!

shakotay2
MEGAVETERAN
Posts: 2819
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 702 times
Been thanked: 1452 times

### Re: League of legends model problems....

wow, you're absolutely incredible!

checked this with

730b 5dFB c15F
011 100110000101101 011101111110111 100000101011111

which should uncompress to
float x=0.134586, y=-0.044547, z=0.015197, w=0.989783 ;

and, yes, it works!

Only "issue" I have is that x and z values are swapped.
edit: errr, I mixed the params s0 and s2, sry
Last edited by shakotay2 on Mon Aug 11, 2014 4:29 pm, edited 2 times in total.
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."

fatduck
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 93 times

### Re: League of legends model problems....

Sorry, I didn't check on the actual animation yet, but

In my defination 3-15-15-15 in axisFlag s2 s1 s0 (High to low)
so:
730b 5dFB c15F
011 100110000101101 011101111110111 100000101011111
3 4C2D 3BF7 415F

calculate by hand:

axisFlag = 3 (quat s2 s1 s0 s3)
s2 = 0x4C2D =result=> 0.13457157444990386669515060884426
s1 = 0x3BF7 =result=> -0.044540687887203588976714377269814
s0 = 0x415F =result=> 0.015192172612689596240119632557146

exactly = quat x=0.134586, y=-0.044547, z=0.015197, w=0.989783 !?

PS:
Just before I forgot about the indices part of the animation

Code: Select all

``````Struct AmnIdx_ver_4 {
dword        Bone_Hash
word         Index_of_Translation    //Reference to Translation_Table
word         Index_of_Scale          //Reference to Translation_Table(Vector3_Table)
word         Index_of_Rotation       //Reference to Rotation_Table
word         null
}

Struct AmnIdx_ver_5 {
word         Index_of_Translation    //Reference to Translation_Table
word         Index_of_Scale          //Reference to Translation_Table(Vector3_Table)
word         Index_of_Rotation       //Reference to Rotation_Table
}``````
No more Fatduck, no more FatImporter, Byebye everyone!

krolik
n00b
Posts: 18
Joined: Fri Apr 18, 2014 12:50 pm
Has thanked: 4 times
Been thanked: 1 time

### Re: League of legends model problems....

Guys, you did an incredible work!!!

I don't want to bother you, but could any one explain this stuff on the example? I am not a total noob, but want to understand the algorithm to convert this logic into code.

shakotay2
MEGAVETERAN
Posts: 2819
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 702 times
Been thanked: 1452 times

### Re: League of legends model problems....

@Fatduck: you're right (as always)
Stupid me called such a function:
Quat Fatduck_quatDecompress(short AxisFlag, short s0, short s1, short s2)
but passed AxisFlag, s2, s1, s0 to it.

@krolik: you've to be more precise. (Do you mean "C" code?)
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."

Wobble
ultra-veteran
Posts: 585
Joined: Tue Jan 04, 2005 9:47 pm
Has thanked: 43 times
Been thanked: 112 times

### Re: League of legends model problems....

[out]
Last edited by Wobble on Sun Mar 12, 2017 11:38 am, edited 1 time in total.

krolik
n00b
Posts: 18
Joined: Fri Apr 18, 2014 12:50 pm
Has thanked: 4 times
Been thanked: 1 time

### Re: League of legends model problems....

shakotay2 wrote: @krolik: you've to be more precise. (Do you mean "C" code?)
Actually C++, but I would like to understand the logic even in pseudo code.

krolik
n00b
Posts: 18
Joined: Fri Apr 18, 2014 12:50 pm
Has thanked: 4 times
Been thanked: 1 time

### Re: League of legends model problems....

I was tried to understand all your discussion and stuck at the point that I totally got lost.
Could someone share his code here how to read this anm file?

krolik
n00b
Posts: 18
Joined: Fri Apr 18, 2014 12:50 pm
Has thanked: 4 times
Been thanked: 1 time

### Re: League of legends model problems....

As I finished coding, I would like to share an additional information. Maybe, it would be helpful for someone.

The right CASE for decompression will look like:

Code: Select all

``````
case AxisFlg of (
3: return (quat s0 s1 s2 s3)
2: return (quat -s0 -s1 -s3 -s2)
1: return (quat s0 s3 s1 s2)
0: return (quat s3 s0 s1 s2)
)``````
The header block changed his structure:

Code: Select all

``````struct LoL_Header_Data (
char magic[8]; //always r3d2anmd
int version;
int data_size; //size of file = data_size + 12
char skip1[12]; //skip this block
int num_bones;
int num_frames;
float fps;
int data_offset1;
char skip2[8];
int data_offset2;
int data_offset3;
int data_offset4;
char skip3[12];
)
num_pos = (data_offset3 - data_offset2)/12;
num_quat = (data_offset1 - data_offset3)/6;``````

hypnolem
ultra-n00b
Posts: 5
Joined: Mon Aug 18, 2014 12:41 pm

### Re: League of legends model problems....

wow

Doctor Loboto
mega-veteran
Posts: 199
Joined: Mon Oct 06, 2008 2:52 am
Has thanked: 18 times
Been thanked: 2 times

### Re: League of legends model problems....

So uh, hate to be a bother again, but is there a completed Noesis Script after all this information, or a method of editing the models so they can be viewed? I went over the whole topic but this is a bit over my head...

finitebytes
ultra-n00b
Posts: 1
Joined: Sat Aug 30, 2014 6:06 am

### Re: League of legends model problems....

So, theoretically, could we get the work done here patched into Riotfiletranslator so that the new model formats can be opened as well has have files saved into that same format?

vossphorus
ultra-n00b
Posts: 2
Joined: Mon Oct 13, 2014 12:02 am

### Re: League of legends model problems....

Hey guys,

First off: I'm really amazed by your detective work on the new *.anm files!

I'm pretty new to this community but I've read all recent posts about League of Legends and it's depending file formats.
I hope I don't ask for something which is already covered somewhere else.

Since the import/export scripts for Maya and Blender are outdated and no longer supported by the developers there's (imho) a need for a simple way to import, modify and export the models.
I'm willing to write an import/export script for Blender (I decided to go with Blender since it's free) but I need some help by a few professionals on this topic.
I've already opened and analyzed the *.skn and *.skl files in a hex editor but I don't quite grasp how it's structured (mainly because I'm relying on old references).

Please don't be too harsh if there's a major fallacy in my naive approach .
It would be really awesome if someone could explain to me how the position of vertices and faces (etc.) is represented in the files.

shakotay2
MEGAVETERAN
Posts: 2819
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 702 times
Been thanked: 1452 times

### Re: League of legends model problems....

vossphorus wrote:I'm willing to write an import/export script for Blender (I decided to go with Blender since it's free)
[...]
It would be really awesome if someone could explain to me how the position of vertices and faces (etc.) is represented in the files.
Afair there's nothing special with the static mesh. Vertex stride of the Twitch is 52 bytes.
Use hex2obj or Noesis to export this model as a wavefront obj. (View posts in this thread as of Thu Apr 17, 2014 1:38 pm
and Thu Apr 17, 2014 3:45 pm.)
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."

vossphorus
ultra-n00b
Posts: 2
Joined: Mon Oct 13, 2014 12:02 am

### Re: League of legends model problems....

Use hex2obj or Noesis to export this model as a wavefront obj.
I did that already. But there's no way to export *.obj files to *.skn files to create remodels for the game.

But could you please elaborate on the structure of the file itself? What's in the header and where does it end? How are the vertex strides themselves structured?
And maybe someone could take a look at this resource and tell me if it's still useable or just totally outdated: https://code.google.com/p/lolblender/wiki/fileFormats.

I'm sorry to bother you with these questions but I'm not a pro at this and I'm still in the process of figuring out what is what.