Page 3 of 51 FirstFirst 1234513 ... LastLast
Results 21 to 30 of 505
  1. #21
    EmuTalk Member
    Join Date
    Sep 2009
    Location
    TX
    Posts
    51
    Mentioned
    0 Post(s)

    Post

    unsigned values do not allow for negative numbers, where as signed values do. so an unsigned 16-bit value would range from +0..+65535, where as a signed 16-bit value would range from -32768...+32767. "Technically" negative numbers would represent the upper half of the unsigned range if converted directly, which is why if you treat a signed number as unsigned you appear to get a very large value. You could visualize the range value wise as being +0...+65535 for unsigned and signed as +0...+32767,-32768...-1 (i.e. 0x7FFF == +32767 and 0x8000 == -32768, 0xFFFF == -1, and so on.)

    Don't know how python handles this. but after a quick search it appears pythons conversion types are already signed, but i don't know what your conversion code looks like.

    in c/c++ it would just be the difference between 'signed short' and 'unsigned short'.
    Last edited by revel8n; February 10th, 2010 at 17:25. Reason: added slightly more info

  2. #22
    The guy with no life... XD Tcll's Avatar
    Join Date
    Jan 2010
    Location
    the forest of darkness
    Posts
    344
    Mentioned
    0 Post(s)
    thanx
    that helps alot.

    here's my code so far
    (it only works for verts)

    use this in idle and copy the data from the interpreter.
    Be sure to get rid of the spaces in the txt file
    instead of F5 50
    it should be F550
    after that...
    just wait for the error at the end of the conversion.
    the error means it's finished.
    Last edited by Tcll; March 1st, 2010 at 19:59.

  3. #23
    The guy with no life... XD Tcll's Avatar
    Join Date
    Jan 2010
    Location
    the forest of darkness
    Posts
    344
    Mentioned
    0 Post(s)
    I think I know why the values arn't exactly perfect
    and I can't believe I didn't think of ths before (FACEPALM)

    what we are dealing with is archive data.
    so we are seeing everything in its compressed value.

    so first off... we would need a decompressor and then a convertor
    I have the convertor... but I don't have the decompressor...
    that's why the values are off.
    Last edited by Tcll; February 10th, 2010 at 20:28.

  4. #24
    The guy with no life... XD Tcll's Avatar
    Join Date
    Jan 2010
    Location
    the forest of darkness
    Posts
    344
    Mentioned
    0 Post(s)
    I just imported PlPkNr and well... it imported with exactly the same layout as FitPikachu00

    so that must mean I'm getting close.

    I guess the IPO's affected the verts when it was compiled

    anyone got any ideas on how armature(bone) data looks??



    • Advertising

      advertising
      EmuTalk.net
      has no influence
      on the ads that
      are displayed
        
       

  5. #25
    EmuTalk Member
    Join Date
    Sep 2009
    Location
    TX
    Posts
    51
    Mentioned
    0 Post(s)
    could you give this a try this for me. may need to be fixed. just curious what you get as output. i am by no means a python programmer. could you send me one of your text files to test with?

    Code:
    import struct
    
    #offset = open("import.dat", 'rb') #my method
    offset = open("import.txt", 'r')
    outfile = open("export.obj", 'w')
    def hex2dec(s):
        return int(s, 16)
    
    a = 0
    while (a == 0):
     of1 = offset.read(4)
     of2 = offset.read(4)
     of3 = offset.read(4)
    
     tmp1 = hex2dec(of1)
     tmp2 = hex2dec(of2)
     tmp3 = hex2dec(of3)
    
     of1 = struct.pack("<HHH", tmp1, tmp2, tmp3)
     of1 = struct.unpack("<hhh", of1)
     tmp1 = float(of1[0]) * 0.01
     tmp2 = float(of1[1]) * 0.01
     tmp3 = float(of1[2]) * 0.01
    
     tmp1 = tmp1.__str__()
     tmp2 = tmp2.__str__()
     tmp3 = tmp3.__str__()
    
     #vert = tmp1+" "+tmp2+" "+tmp3+" "+tmp4+" "+tmp5+" "+tmp6 #hex
     vert = "v "+tmp1+" "+tmp2+" "+tmp3 #obj
    
     print vert
     outfile.write(vert+"\n")
    Last edited by revel8n; February 10th, 2010 at 20:48.

  6. #26
    The guy with no life... XD Tcll's Avatar
    Join Date
    Jan 2010
    Location
    the forest of darkness
    Posts
    344
    Mentioned
    0 Post(s)
    OMG How the freak did you do that!!! <8O

    it don't need to be fixed
    it imports perfectly.

    you've just fixed the freakin grid bug I was dealing with. 8D

    anyways...
    as for a test file...

    all I have right now is Pk to compair it with brawl Pk...
    but here you go:
    Download

    what does "struct" do??
    and "\n" does that mean enter??
    -----------------------------------------------
    now we need to impress Milun. XP XD
    Last edited by Tcll; February 10th, 2010 at 21:34.

  7. #27
    EmuTalk Member
    Join Date
    Sep 2009
    Location
    TX
    Posts
    51
    Mentioned
    0 Post(s)
    "\n" is for newline - which is similar to what pressing enter would do when typing, yes.

    struct was necessary for accessing the pack and unpack functionality for python. i looked these things up on google solely to achieve the results i was looking for. Cannot really tell you too much more about python related functionality as i am a c/c++ programmer. But basically the 'H' used in pack converts things to unsigned short (16-bit) values while the 'h' format specifier used with unpack treats the values as signed short values. Then i just convert the values to float so that i can scale the values down by 100 (* 0.01). Technically the values don't really need scaling, and if things come out smaller than you would like you can just change the scale value i use, but best to keep them consistent if you are going to be converting multiple files.

  8. #28
    The guy with no life... XD Tcll's Avatar
    Join Date
    Jan 2010
    Location
    the forest of darkness
    Posts
    344
    Mentioned
    0 Post(s)
    so my bug was between the signed/unsigned ints...
    hmm...

    I don't have an idea for faces however...
    but that would definatly impress Milun XD

    btw: I've got the final code right here:
    Code:
    import struct as S
    off = open("import.txt", 'r')
    out = open("export.obj", 'w')
    a = 0
    while (a == 0):
     t1 = off.read(4)
     t2 = off.read(4)
     t3 = off.read(4)
     
     t = S.pack("<HHH", int(t1, 16), int(t2, 16), int(t3, 16))
     t = S.unpack("<hhh", t)
     x = float(t[0]) * 0.01
     y = float(t[1]) * 0.01
     z = float(t[2]) * 0.01
     v = "v "+x.__str__()+" "+y.__str__()+" "+z.__str__()
     print v
     out.write(v+"\n")
    do you have any idea on how to work the faces??
    Last edited by Tcll; February 10th, 2010 at 22:21.

  9. #29
    EmuTalk Member
    Join Date
    Sep 2009
    Location
    TX
    Posts
    51
    Mentioned
    0 Post(s)
    The faces work as i described earlier. The first value in a group of indices is the vertex index, then you may or may not have index values for normals and uv coordinates. The data repeats this pattern for the number of indices specified after the primitive flags. To determine how to build faces you have to look at the primitive type value you get from the primitive flags (triangles means every 3 index groups defines an individual face, and so on). If you are not accustomed to the methods used to render things in real-time graphics may need to look into that for some useful information (both opengl and direct3d documentation have information on interpreting the various primitive types).

    Finding the data in the first place can be a little tricky if you are doing it by hand, although it is easy to pick out once you have found the right area in the file. i am looking into some things i have been trying to decipher to see if it holds some of the relevant data i am seeking. i use 010 Editor (www.sweetscape.com) and i may have some things that would make it even easier to see the relevant data through the use of their binary template format. Will have to see what i can dig up.

    Also note that because gamecube/wii api design allows for indexing vertices, normals, and uv coordinates separately, it is quite likely you will need to have a prepass that either converts things to triangle lists (duplicating vertices and other values as necessary depending on the support of your intended application or renderer api).

    Let me know what other questions you may have, and i will see what information i can provide.
    Last edited by revel8n; February 10th, 2010 at 23:22.

  10. #30
    The guy with no life... XD Tcll's Avatar
    Join Date
    Jan 2010
    Location
    the forest of darkness
    Posts
    344
    Mentioned
    0 Post(s)
    this 010 Editor is amazing 8D

    and I kinda mis-stated myself...
    I ment how do I decipher the face data??
    I would like to know the math on how to if you know...

    im tired of reading through numberous docs that dont tell me exactly what I need to know...
    IDK...
    maybe it's just my fault...
    maybe I do have what I need to know...
    but I'm just not looking at it correctly.

    but yea I do have 1 Q:
    how do I find/decipher the bone data??
    Last edited by Tcll; February 11th, 2010 at 15:43.

Page 3 of 51 FirstFirst 1234513 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •