Decent FF7 Model Viewer

  • Thread starter Thread starter Sephiroth2000
  • Start date Start date
Status
Not open for further replies.
Those are the rotations I get when I use Windows® Calculator but for my code it’s just not coming together, even when I reverse the bytes.

I wrote a very simple script to parse these files before diving into C++ with it and the output in the scripts are perfectly fine:

Code: [Select]
Code:
< 0 0 0 >< 270 333.105469 0 >< 348.925781 357.626953 327.128906 >< 16.435547 17.578125 61.523438 >< 332.050781 337.675781 245.214844 >…


I guess you can post your code if you like.  Much appreciated mi amigo.

L. Spiro

P. S.: 0x0FC8EB30 through 0x0FC8EC44 is one full frame of Cloud’s kneeling animation (near death).  I do not yet know how many frames precede this one in this animation so I do not know the exact start of his kneeling animation.
When unpacked, rtda should contain one frame that matches this one exactly (I will post a dump).


Code: [Select]
Code:
0FC8EB30 0.   (Base-rtam)0FC8EB34 12.480470FC8EB38 1.6699220FC8EB3C 329.7656 (Body-rtan)0FC8EB40 16.435550FC8EB44 17.578130FC8EB48 61.52344 (Head-rtao)0FC8EB4C 355.1660FC8EB50 343.30080FC8EB54 239.67770FC8EB58 33.134770FC8EB5C 87.802730FC8EB60 56.865230FC8EB64 54.755860FC8EB68 51.328130FC8EB6C 344.0918 (Shoulder-rtar)0FC8EB70 320.36130FC8EB74 0.0FC8EB78 0.   (Lower Arm-rtas)0FC8EB7C 0.96679690FC8EB80 7.2070310FC8EB84 334.5117 (Hand-rtat)0FC8EB88 18.984380FC8EB8C 26.982420FC8EB90 65.478520FC8EB94 61.8750FC8EB98 357.97850FC8EB9C 13.623050FC8EBA0 39.111330FC8EBA4 255.05860FC8EBA8 328.7109 (Shoulder-rtaw)0FC8EBAC 338.90630FC8EBB0 0.0FC8EBB4 0.   (Lower Arm-rtax)0FC8EBB8 352.96880FC8EBBC 359.64840FC8EBC0 329.502 (Hand-rtay)0FC8EBC4 0.0FC8EBC8 199.77540FC8EBCC 0.0FC8EBD0 61.171880FC8EBD4 20.039060FC8EBD8 247.7637 (Upper Leg-rtba)0FC8EBDC 71.806640FC8EBE0 0.0FC8EBE4 0.   (Lower Leg-rtbb)0FC8EBE8 349.01370FC8EBEC 344.88280FC8EBF0 75.67383 (Upper Foot-rtbc)0FC8EBF4 298.1250FC8EBF8 0.0FC8EBFC 0.   (Lower Foot-rtbd)0FC8EC00 0.0FC8EC04 47.900390FC8EC08 0.0FC8EC0C 3.8671880FC8EC10 293.73050FC8EC14 2.988281 (Upper Leg-rtbf)0FC8EC18 70.576170FC8EC1C 180.0FC8EC20 180.  (Lower Leg-rtbg)0FC8EC24 307.96880FC8EC28 357.18750FC8EC2C 2.197266 (Upper Foot-rtbh)0FC8EC30 300.05860FC8EC34 0.0FC8EC38 0.   (Lower Foot-rtbi)0FC8EC3C 0.0FC8EC40 0.

I can post as many frames ahead and behind this as you like but I just can’t tell when this animation ends and the next begins.

When I get my program to load things correctly I can track down the first frame of the first animation in RAM and then export all the following frames so we can see how each should appear, and that should help decode the format much more easily, don’t you think?
 
mirex, I think maybe you should definitely post that code.

After looking more closely at my list (generated by script) and yours on the other page, and compared to Cyberman’s, my list matches Cyberman’s exactly and yours is way off in left field.

So here goes the first animation rotation data of battle cloud:

bones = 23

AnimHdr:
rec_a = 24
rec_b = 90
block_len = 5656
block_a = 90
real_data_len = 5650
translat = < 0, 65024, 62 >
u1 = 0

<270, 333, 0>
<356, 353, 327>
<16, 17, 61>
<338, 334, 243>
<34, 89, 61>

I get 24 for rec_a, sure.
rec_b is 20.  Where did you get 90?
block_len is 5656??  Is this rtda?

So when I decoded mine, all of my values matched Cyberman’s exactly.
So obviously Cyberman and I made the same mistake(s).

I modified my loader to perform a 4-bit swap chain at various times during the shifting of the bits but no combination of swapping/shifting/reversing works to get either the results of my script/Cyberman’s results or your results.
One attempt was close but he was mounting a horse and looking over his shoulder.

L. Spiro
 
Spiro I can't find my data in this thread, where did you find it?!
In any case mine almost exactly matches mirex's now.

Are you reading the data in by bytes from the file or loading it into a structure? If the later be sure you have your structure alignment in your copilor optimizations set to BYTE instead of double or quad word. It will never look right otherwise.

My structures that I've posted won't work without that little detail :)

As for reading the 12 bit ints.  I do it thus.
Code: [Select]
Code:
      if (Odd)      {         AI[0] = (*A_Decode <<8) & 0xFF00 | *(A_Decode + 1);         AI[0]&= 0xFFF;         A_Decode+=2;         AI[1] = (*A_Decode <<8) & 0xFF00 | *(A_Decode + 1);         AI[1]>>= 4;         A_Decode++;         AI[2] = (*A_Decode <<8) & 0xFF00 | *(A_Decode + 1);         AI[2]&= 0xFFF;         A_Decode +=2;      }      else      {         AI[0] = (*A_Decode <<8) & 0xFF00 | *(A_Decode + 1);         AI[0] >>= 4;         A_Decode++;         AI[1] = (*A_Decode <<8) & 0xFF00 | *(A_Decode + 1);         AI[1]&=0xFFF;         A_Decode+=2;         AI[2] = (*A_Decode <<8) & 0xFF00 | *(A_Decode + 1);         AI[2] >>= 4;         A_Decode++;      }      Odd = !Odd;      Bone->Alpha =  AI[0] * 360.0/4096.0;      Bone->Beta =   AI[1] * 360.0/4096.0;      Bone->Gamma =  AI[2] * 360.0/4096.0;

Where A_Decode is a unsigned char array.
AI is an array of ints
Odd is boolean and initialized to false.
Most of my problems were silly mistakes so look at what your code is doing and be sure it's what it's supposed to be doing :D

Cyb
 
All right I have had some success with getting CLOUD.LZS working however I think I'm translating the wrong direction or something :lol: because it looks a bit wrong (after using the original data). Hmmm looks OK just the wrong direction I suspect for translating.  I've tried X and Y I suppose all that's left is Z (this is Y).
CLOUD_01.jpg


I also need to be sure to have the quads and triangles ordered right, something isn't working right with that, I believe I'm missing a gl cull call.  Hmmm.

Cyb
 
I've had things look like that once. I was drawing quads in the wrong order. Doh!
 
Cyberman, I posted your code exactly and it’s not working for me.

Code: [Select]
Code:
  if ( Odd ) {    baEachNumber[0] = (*baData <<8) & 0xFF00 | *(baData + 1);   baEachNumber[0] &= 0xFFF;   baData += 2;   baEachNumber[1] = (*baData <<8) & 0xFF00 | *(baData + 1);   baEachNumber[1] >>= 4;   baData++;   baEachNumber[2] = (*baData <<8) & 0xFF00 | *(baData + 1);   baEachNumber[2] &= 0xFFF;   baData +=2;  }  else {   baEachNumber[0] = (*baData <<8) & 0xFF00 | *(baData + 1);   baEachNumber[0] >>= 4;   baData++;   baEachNumber[1] = (*baData <<8) & 0xFF00 | *(baData + 1);   baEachNumber[1] &=0xFFF;   baData += 2;   baEachNumber[2] = (*baData <<8) & 0xFF00 | *(baData + 1);   baEachNumber[2] >>= 4;   baData++;  }  Odd = !Odd;  fTemp0 = baEachNumber[0] * 360.0f / 4096.0f;  fTemp1 = baEachNumber[1] * 360.0f / 4096.0f;  fTemp2 = baEachNumber[2] * 360.0f / 4096.0f;  AttachRotationToBone( 0, iCount, fTemp0, fTemp1, fTemp2 );


baData is your A_Decode and it is where I stored the entire list of data bytes for the animation.
baEachNumber is clearly where I have store each byte from that array temporarily.
In this case I am doing exactly as you were (shifting my pointer up along the line to get each byte) but I rewrote it to use an index instead but the results were exactly the same.

As for how I am loading it…
I am creating a dynamic byte array

Code: [Select]
Code:
byte * baData = new byte[iChunkSize];

and then reading directly into it

Code: [Select]
Code:
if ( !fread( baData, iChunkSize, 1, file ) ) { return; }
.


The bytes are aligned correctly because I can walk them in the debugger and view them with my hex viewer to see that they match the data file exactly.
I am reading at the correct offset inside the file as well.  baData starts as “00 00 00 00 0C…”.

Your method is giving me these results:

Code: [Select]
Code:
< 0.000 0.000 0.000 >< 0.000 1.230 0.000 >< 0.126 20.13 0.879 >< 16.44 0.703 16.52 >

These numers are all so low it makes me suspect your shifts are in the opposite direction of mine.

In my original code, I shifted << (left) to decrease the bytes.
I notice in your code you shift by 4’s going right.

Sigh.  This is the whole reason for any confusion at all.  If machines and operating systems didn’t switch the lower-end bits all the time…

I tried switching your >>’s to <<’s and <<’s to >>’s but that failed also.


For a moment, I am going back to my original code.


Code: [Select]
Code:
  iCurrentBit = I * 12;    // Calculate the current bit.  iBytewiseOffset = iCurrentBit / 8; // Get the offset of the byte that has that bit.  iBitwiseOffset = iCurrentBit % 8; // Calculate how many bits we need to shift.  iTemp = * (unsigned int *)(&baData[iBytewiseOffset]);  iTemp = iTemp << iBitwiseOffset;  SwapAllBytes( (byte *) &iTemp, sizeof( iTemp ) );  iTemp = iTemp & 0xFFF;  if ( I % 3 == 0 ) {   fTemp0 = (float)iTemp * 360.0f / 4096.0f;  }  if ( I % 3 == 1 ) {   fTemp1 = (float)iTemp * 360.0f / 4096.0f;  }  if ( I % 3 == 2 ) {   fTemp2 = (float)iTemp * 360.0f / 4096.0f;   AttachRotationToBone( 0, iCount, fTemp0, fTemp1, fTemp2 );   iCount++;  }


What this does is…

Calculate the current bit.
Calculate which byte has that bit (iCurrentBit / 8).
Calculate the shifting offset (iCurrentBit % 8).
Cast a 4-byte unsigned integer to the value at “iBytewiseOffset” in the array.
Code: [Select]
Code:
  iTemp = * (unsigned int *)(&baData[iBytewiseOffset]);
Now the four bytes that make up “iTemp” are the same four bytes that are in the “iBytewiseOffset” location in the stored data array.
baData[3] is “00 0C 00 EC” (EC 00 0C 00 on Windows® Calculator) which makes iTemp 3959426048.
We shift those four bytes left by “iBitwiseOffset” (which toggles between 0 and 4 appropriately, via the math used).
3959426048 becomes 3221274624, or “00 C0 00 C0” (C0 00 C0 00 on Windows® Calculator).

Then we take only the first three byte halves, so we “iTemp &= 0xFFF;”.

Do the math from there to get the results.


How can this not work?  We go right to the byte that holds our data and shift it by either 0 or 4 appropriately.  Then take only the first 12 bits and do the math on them.  It’s perfectly logical.  Check the formulas to see that my math to go to the appropriate byte and to calculate between 0 and 4 bitwise shift IS correct and it works perfectly.


I have modified this in every way.  I changed the unsigned int to an unsigned short (to read only the first two bytes).  I have changed the order and directiono f the shifting.

Everything.
 
Did you initialize Odd to false?

Let's say your first set of numbers are
Code: [Select]
Code:
00 00 00 00 0C 00 EC E0 00
And they are numbered
Code: [Select]
Code:
00 01 02 03 04 05 06 07 08
from left to right


first you start off at 0 which is EVEN (see odd is false).
You have 3 ints to load the data into (lets say).
A B and C

A = byte 00 << 8
That is byte 0 is shifted left 8 place.
A |= byte 01
So now A has the value 00 00 in it
the hexdecimal numbers are ordered like this
Code: [Select]
Code:
01 2300 00
You only want the upper 12 bits and they need to be right justified so
A >>=4;
and
Code: [Select]
Code:
-0 1200 00
is left
The lower 4 bites of byte 1 and all of byte 2 make up the next 12 bit integer.
So
B = Byte 1 << 8
B |= Byte 2
B &= 0xFFF;

This removes the upper four bits we don't want.
again we get 0 in this case but HEY! :)
The next 12 bit in it's
C = Byte 3 << 8
C |= Byte 4;
C is now 000C
C >>=4;
C is now 000

Now we are ODD yep it's bone 1 now

A = Byte 4 << 8
A |= Byte 5
A &= 0xFFF
A = C00
or 3072 * 360.0 / 4096
or 270.0 degrees.

etc etc.. that's how I decode them at least

Cyb
 
Hmmmm here is my code, only from what i remember ... i forgot to put it on the floppy and to bring it here on internet pc ... duh why i dont have internet at home...  -_-
Code: [Select]
Code:
unsigned char* data;int odd;unsinged long data_pointer;odd = 0;data_pointer = 0;for( i=0; i<bones_count; i++ ) {    //  these comments are zero indexed as arrays in c++ :)    // x - take 0st byte and higher 4 bits of 1nd byte    // y - take lower 4 bits of 1nd and whole 2rd    // z - take 3th byte and higher 4 bits of 4th       if ( odd == 0 ) {       x = data[ data_pointer ] << 4 + data[ data_pointer + 1 ] >> 4;       y = ( data[ data_pointer+1 ] & 0xF ) << 8 + data[ data_pointer + 2 ];       z = data[ data_pointer + 3 ]  << 4 + data[ data_pointer + 4 ] >> 4;       data_pointer += 4;    } else {       x = ( data[ data_pointer ] & 0xF ) << 8 + data[ data_pointer + 1 ];       y = data[ data_pointer + 2 ] << 4 + data[ data_pointer + 3 ] >> 4;       z = ( data[ data_pointer + 3 ] & 0xF ) << 8 + data[ data_pointer + 4 ];       data_pointer += 5;    }  odd = 1 - odd;}

hmm now when i compare some data from RTDA (http://bin.mypage.sk/FILES/RTDA) i see that my documentation is maybe wrong ... but anyhow when i take data from RTDA offset 0x24:
Code: [Select]
Code:
FD 2F B2 E9;  10 BB 0C 82split it by 12 bits:FD2 FB2 E91   0BB 0C8  (notice relation to original data, and compare it to your calculations results)and then multiply it by * 360 / 4096 to get angles i get355,353,327; 16,17...which are right the data from the animation <270, 333, 0> <356, 353, 327>     <---<16, 17, 61>          <---<338, 334, 243> <34, 89, 61>
So i'll have to take a look at the documents and update them.

--edited lotsa times--
 
I am finally getting the correct rotations (khob khun krap) but I remembered something from a long time ago (this was not affecting my results with getting the correct animation data).

Something was wrong when I loaded models that forced me to load their inverse Y and Z coordinates (per vertex and normal) in order to get their animations to align properly.

When animating, ficedula had told me to do this:
Code: [Select]
Code:
dxRotatef( -fTempYr, 0, 1, 0 ); dxRotatef( fTempXr, 1, 0, 0 ); dxRotatef( -fTempZr, 0, 0, 1 );
He said you had to rotate in that order and by the inverse of the Y and Z (strange how those were the same coordinates I had to reverse to get my model to align properly!).

Now that my battle models have loaded with the correct data, they aren’t displaying properly.
I can’t perform this same translation on them for whatever reason, even though it worked perfectly on all overworld models.

Since you have mentioned how to rotate them but did not mention anything about inverses or order, I am wondering now how to correct whatever was wrong back then (the correct way, instead of loading inverted vertices).


I'm rotating in YXZ order, by negative Y and Z, and then translating by (+)bone length along the Z:
Code: [Select]
Code:
dxTranslatef( 0, 0, m_pBone[I].GetLength() );


Anything wrong with this?
None of my models align at all anymore when I load without inverting each Y and Z vertex/normal.

This is all called in the same manner as you had posted, with each per bone per child, recursively.  Consistant motion is created but the ends of each 3D model don’t end where the bones end.
 
Hmmmm here is my code, only from what i remember ... i forgot to put it on the floppy and to bring it here on internet pc ... duh why i dont have internet at home...  -_-
USB flash drive time?

Have an idea why my pieces aren't too integrated with cloud mirex? :)

I need to be sure I am doing back face removal! DOH!

Cyb/Stephen
 
USB flash drive time?
Duh not having any ... seems too expensive to me for just a 128MB ... i could have HDD 40GB for that price ... so i use floppies and HDD's :)
Have an idea why my pieces aren't too integrated with cloud mirex?  
I need to be sure I am doing back face removal! DOH!
Thats simple, your skelet is not calculated properly, or your model parts are not lined up with skelet ;) Try drawing skeleton aswell (you can use glBegin( LINE ) command), then you will see clearly what's wrong.
 
Can you do me a favor (mirex)?

Try adding something that exports information to a file for each bone you draw on Cloud’s model.
The information just needs to be which bone, and the rotation for that bone.

It may be possible for me to be walking the bones in a slightly wrong order.  So I need to see the order of the bones when walked correctly and the rotation for each bone.


Thank you in advance.
L. Spiro
 
Here are my results.
These lists are organized by order of drawing/rotating, walking down the bone tree.  It just happens that each child down the line is the next bone in the master list.  For each child the matrix is pushed and popped, so the parent rotations carry into the child, and the child is then rotated from there.

For Battle Cloud:
Code: [Select]
Code:
Bone   0: Name: rtam, Parent:  -1, Children:   3, Rotations:   0.00000000   0.00000000   0.00000000  Translating:  -39.00000000Bone   1: Name: rtan, Parent:   0, Children:   1, Rotations: 270.00000000 333.10546875   0.00000000  Translating: -163.00000000Bone   2: Name: rtao, Parent:   1, Children:   0, Rotations: 348.92578125 357.62695313 327.12890625  Translating: -146.00000000Bone   3: Name:     , Parent:   0, Children:   1, Rotations:  16.43554688  17.57812500  61.52343750  Translating: -141.00000000Bone   4: Name:     , Parent:   3, Children:   1, Rotations: 332.05078125 337.67578125 245.21484375  Translating: -59.00000000Bone   5: Name: rtar, Parent:   4, Children:   1, Rotations:  34.27734375  90.08789063  61.96289063  Translating: -133.00000000Bone   6: Name: rtas, Parent:   5, Children:   1, Rotations:  74.88281250  42.53906250 335.21484375  Translating: -117.00000000Bone   7: Name: rtat, Parent:   6, Children:   0, Rotations: 322.29492188   0.00000000   0.00000000  Translating: -85.00000000Bone   8: Name:     , Parent:   0, Children:   1, Rotations:   3.69140625   8.52539063 336.18164063  Translating: -141.00000000Bone   9: Name:     , Parent:   8, Children:   1, Rotations: 358.50585938  21.09375000  53.34960938  Translating: -59.00000000Bone  10: Name: rtaw, Parent:   9, Children:   1, Rotations:  66.18164063   0.52734375  15.90820313  Translating: -133.00000000Bone  11: Name: rtax, Parent:  10, Children:   1, Rotations:  56.25000000 242.05078125 318.77929688  Translating: -117.00000000Bone  12: Name: rtay, Parent:  11, Children:   0, Rotations: 338.20312500   0.00000000   0.00000000  Translating: -76.00000000Bone  13: Name:     , Parent:  -1, Children:   1, Rotations: 354.72656250 358.68164063 332.22656250  Translating:  -37.00000000Bone  14: Name: rtba, Parent:  13, Children:   1, Rotations:   0.00000000 229.04296875   0.00000000  Translating: -277.00000000Bone  15: Name: rtbb, Parent:  14, Children:   1, Rotations:  58.44726563 313.68164063 235.28320313  Translating: -253.00000000Bone  16: Name: rtbc, Parent:  15, Children:   1, Rotations:  24.96093750   0.00000000   0.00000000  Translating: -77.00000000Bone  17: Name: rtbd, Parent:  16, Children:   0, Rotations: 303.83789063 358.76953125  68.20312500  Translating: -121.00000000Bone  18: Name:     , Parent:  -1, Children:   1, Rotations: 298.91601563 358.41796875   1.40625000  Translating:  -37.00000000Bone  19: Name: rtbf, Parent:  18, Children:   1, Rotations:   0.00000000  77.16796875   0.00000000  Translating: -277.00000000Bone  20: Name: rtbg, Parent:  19, Children:   1, Rotations:  31.46484375 270.35156250   7.64648438  Translating: -253.00000000Bone  21: Name: rtbh, Parent:  20, Children:   1, Rotations:  58.44726563   0.00000000   0.00000000  Translating: -77.00000000Bone  22: Name: rtbi, Parent:  21, Children:   0, Rotations: 331.25976563 349.36523438   5.97656250  Translating: -121.00000000
This results in:
BentCloud.png


For Overworld Cloud:
Code: [Select]
Code:
Bone  0: Name:      hip, Parent: -1, Children: 3,Rotations: 270.00000000   0.00000000   0.00000000  Translating:  -1.74572361Bone  1: Name:    chest, Parent:  0, Children: 1,Rotations:  49.21875000   0.00000000   0.00000000  Translating:  -5.18153906Bone  2: Name:     head, Parent:  1, Children: 0,Rotations: 313.59375000   0.00000000   0.00000000  Translating:  -6.83338976Bone  3: Name:  l_chest, Parent:  0, Children: 1,Rotations:  36.56250000 315.00000000  40.78125000  Translating:  -4.98453712Bone  4: Name: l_collar, Parent:  3, Children: 1,Rotations: 300.93750000 323.43750000  39.37500000  Translating:  -2.30645990Bone  5: Name:  l_uparm, Parent:  4, Children: 1,Rotations: 316.40625000  39.37500000  57.65625000  Translating:  -2.73342323Bone  6: Name:  l_foarm, Parent:  5, Children: 1,Rotations: 282.65625000   0.00000000   0.00000000  Translating:  -4.60069847Bone  7: Name:   l_hand, Parent:  6, Children: 0,Rotations:   0.00000000   0.00000000   0.00000000  Translating:  -2.27860451Bone  8: Name:  r_chest, Parent:  0, Children: 1,Rotations:  36.56250000  45.00000000 320.62500000  Translating:  -4.98453712Bone  9: Name: r_collar, Parent:  8, Children: 1,Rotations: 303.75000000  30.93750000 324.84375000  Translating:  -2.30645990Bone 10: Name:  r_uparm, Parent:  9, Children: 1,Rotations: 322.03125000 298.12500000 323.43750000  Translating:  -2.73342323Bone 11: Name:  r_foarm, Parent: 10, Children: 1,Rotations: 288.28125000   0.00000000   0.00000000  Translating:  -4.60069847Bone 12: Name:   r_hand, Parent: 11, Children: 0,Rotations:   0.00000000   0.00000000   0.00000000  Translating:  -2.27860451Bone 13: Name:    l_hip, Parent: -1, Children: 1,Rotations:   0.00000000 251.71875000 180.00000000  Translating:  -1.98165441Bone 14: Name:  l_femur, Parent: 13, Children: 1,Rotations: 289.68750000  63.28125000   7.03125000  Translating:  -5.28867340Bone 15: Name:  l_tibia, Parent: 14, Children: 1,Rotations:  29.53125000   0.00000000   0.00000000  Translating:  -7.72580004Bone 16: Name:   l_foot, Parent: 15, Children: 0,Rotations: 284.06250000 191.25000000 171.56250000  Translating:  -6.90587616Bone 17: Name:    r_hip, Parent: -1, Children: 1,Rotations:   0.00000000 108.28125000 180.00000000  Translating:  -1.98165441Bone 18: Name:  r_femur, Parent: 17, Children: 1,Rotations: 309.37500000 108.28125000 180.00000000  Translating:  -5.28867340Bone 19: Name:  r_tibia, Parent: 18, Children: 1,Rotations:  47.81250000 180.00000000 180.00000000  Translating:  -7.72580004Bone 20: Name:   r_foot, Parent: 19, Children: 0,Rotations: 272.81250000 175.78125000 181.40625000  Translating:  -6.90587616
You’ll notice this time I reversed the translations along the Z.  This gets this result:
BentSmallCloud2.png

But notice that even though the bones land in the right spots they are on the wrong side of Cloud.  This only shows because of the coloring on his arm and shoulder.  On Yuffie, of course, her whole arm is backwards.
If I DON’T translate along the Z by the NEGATIVE bone length, this is what happens:
BentSmallCloud.png


Each part is facing the correct direction, and is on the correct side of his body, but the bones went in the wrong direction.  After placing his body, instead of going up to place his head, it went down and put his head under his ass instead, in the exact opposite direction it was supposed to go.
That is why I reversed the bone lengths in the first place.
Then, to fix the problem with his part landing on the wrong sides, I reversed the Y and Z vertex coordinates on each model upon loading.


The first and last shots are without any modifications to the bone lengths and all of them are without modifications to the vertices upon loading (or after).

I suspect I may be walking in the wrong order, but that doesn't explain why reversing the things I reversed fixes the problem (actually it isn’t fixed with my method; the models align properly, but are exactly mirrored of what they should be).

So I posted my walking order and all the information there is about each bone.

The information about Battle Cloud is his first frame.
The other Cloud’s information is just some frame from aaga.a.

L. Spiro
 
I've made some progress it's still not right but it's better, I think something is messed up somewhere but
CLOUD_02.jpg

is a lot better I would say.

L. Spiro doing good there!

Mirex
I seem to be having trouble getting the Lines to be drawn OVER model, do I have to make the model semi transparent for them to be properly visable or something?

Cyb
 
I seem to be having trouble getting the Lines to be drawn OVER model, do I have to make the model semi transparent for them to be properly visable or something?
if you want to draw them over the model you have to disable depth checking.

1) enable depth check so model will be drawn properly:
glEnable( GL_DEPTH_TEST );
2) draw your model
3) disable depthcheck by glDisable( GL_DEPTH_TEST );
4) draw bone lines
and voila there it is, bones allways on top of the model :)

reason is that if depth test is on, there is test if drawn item should be drawn or it is 'hidden' behind some other graphic object. If depth test is off no test is performed, and item is drawn anyhow.
 
Any possible solutions to my problem at all?

What could possibly cause all the correct numbers to place his head under his ass instead of on his shoulders?

I’m definitely not walking in the wrong order.
The bones are definitely loaded correctly and so are the animations.
The models are loaded correctly as well, as shown in the pictures.

But the only error is that the bone goes down instead of up.

Anyone want to post their code of walking/drawing the bone tree with recursion?


L. Spiro
 
I think your documentation may be off, mirex.
To get this result:
BattleCloud.png

I had to seek past 4 extra bytes at the start of the animation (go after “u1” in the document) and then skip four MORE bytes, AND start with Odd set to false instead of true (when I copied your code from above, it starts as true).

Weird.

But now you can see I am back to the same problem I had with the overworld models.  Everything is on the wrong side.


HEEEEELLLP!!!


L. Spiro
 
if everything is on the wrong side try:
-flipping model coordinates ( negate Y coords or something )
-switching one rotation from positive to negative values
 
Status
Not open for further replies.
Back
Top