Page 6 of 51 FirstFirst ... 4567816 ... LastLast
Results 51 to 60 of 505
  1. #51
    The guy with no life... XD Tcll's Avatar
    Join Date
    Jan 2010
    Location
    the forest of darkness
    Posts
    344
    Mentioned
    0 Post(s)
    here is an update to the original code...
    it's written more in the Python manner.
    Code:
    import struct as S
    dat = open("import.dat", 'rb')
    obj = open("export.obj", 'w')
    #mtl = open("export.mtl", 'w')
    def vert(v): 
        return (float(S.unpack("<h", S.pack("<H", int((v.encode('hex')), 16)))[0]) * 0.01).__str__()
        #v x y z
    """
    def face ():
        return 
        #f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 (tri)
        #f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 v4/vt4/vn4 (quad)
    """
    t0 = dat.read(32)#header
    a = 0
    while (a == 0):
        v = "v "+vert(dat.read(2))+" "+vert(dat.read(2))+" "+vert(dat.read(2))
           if (v == 'v 0.0 0.0 0.0'):
            a = 1
            #f = "f "+face()+" "+face()+" "+face()
        else:
            print v
            #obj.write(v+"\n")
    you can use it if you wan't...
    you can delete those little notes I've left myself if you want.

    yea...
    if you havn't figured out yet,
    I'm kinda using this forum as an update log...

    Last edited by Tcll; February 12th, 2010 at 04:56.


    • Advertising

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

  2. #52
    EmuTalk Member
    Join Date
    Dec 2009
    Posts
    79
    Mentioned
    0 Post(s)
    Quote Originally Posted by Tcll View Post
    hey Milun...
    for deciphering the faces...
    what was that equation you used??
    Uh... not sure what you mean by that, but I had no equation. All I did was I converted the numbers in the 2 left columns (06 46, 06 47, 06 48) into decimal values, then added one to the result, and every 3 that I had were a face.



    Also, how would I go about using your above code? Do I copy the face data into a .txt, or rename a .dat into import.dat or what? Sorry, despite the fact I use Blender a lot, I'm a really big Python noob.
    Last edited by Milun; February 12th, 2010 at 06:13.

  3. #53
    The guy with no life... XD Tcll's Avatar
    Join Date
    Jan 2010
    Location
    the forest of darkness
    Posts
    344
    Mentioned
    0 Post(s)
    never mind... forget the equation...

    hmm... seems I don't know nearly as much as I thought...
    I got the verts completed... the faces should only be a little tougher...

    do you have the code you used for the faces??
    maybe I can decipher that to get an idea...

    as for your last Q:
    just rename the dat
    but faces don't work yet...
    it's just a re-type of the original code.

    your probably not as much of a noob as me
    but it's not really hard at all...
    if you know algebra, Python shoud be a breeze.
    Last edited by Tcll; February 13th, 2010 at 00:29.

  4. #54
    The guy with no life... XD Tcll's Avatar
    Join Date
    Jan 2010
    Location
    the forest of darkness
    Posts
    344
    Mentioned
    0 Post(s)
    YAY!!!

    I got the faces importing finally

    yea it still needs a bit of fine tuning...

    can anyone help me on identifying the normal (vn) values??
    Last edited by Tcll; February 13th, 2010 at 01:48.

  5. #55
    EmuTalk Member
    Join Date
    Dec 2009
    Posts
    79
    Mentioned
    0 Post(s)
    Nice! Sorry, I can't help you with the normals, I never figured them out.

    A sad fact though, even if you get all the faces decoded, Pikachu will still have about 66% gaps in the faces. I haven't been able to figure out how to fix them.

    Edit: I may have found a sure fire way to patch up the holes. I need to research it a bit, but as soon as I do, I'll upload!
    Last edited by Milun; February 13th, 2010 at 05:24.

  6. #56
    The guy with no life... XD Tcll's Avatar
    Join Date
    Jan 2010
    Location
    the forest of darkness
    Posts
    344
    Mentioned
    0 Post(s)
    hmm...
    then it looks like I've got a good model to start with.

    I'm going over jahra!ns code right now...
    just to see if I can't figure anything else out...

  7. #57
    EmuTalk Member
    Join Date
    Dec 2009
    Posts
    79
    Mentioned
    0 Post(s)
    Don't get your hopes up though, I'm beginning to doubt my gap theory.

  8. #58
    EmuTalk Member
    Join Date
    Sep 2009
    Location
    TX
    Posts
    51
    Mentioned
    0 Post(s)
    0x98 is the primitve type value for triangle strips. unlike triangle list every 3 vertices does not form a single triangle. After the initial 3 vertices, every vertex after that uses the previous 2 index values to create a new triangle.

    So if you have the index values:
    0 1 2 3 4 5 6
    if you treated this as a triangle list you would get:
    [0 1 2], [3 4 5]
    and not have enough index values.

    instead for a triangle strip the actual triangles will be:
    [0 1 2], [1 2 3], [2 3 4], [3 4 5], and [4 5 6]
    which means you would have missed 3 whole triangles if you interpreted things as a list of triangles.

    So you have to make sure you take the various primitive types into account. The normals and uvs should work similarly except since normals are unit length you would have to divide the values you get by say 32,767 if the values are 16-bit, which would convert values to a range of -1 to 1 in floating point. UV coordinates would be converted similarly. This is under that assumption the values are not already in floating point, and are 16-bit within the range of -32,767 and 32,767.


    As far as faces go, like i mentioned earlier, the gamecube/wii allows for indexing vertices, normals, and uv coordinates separately, so unfortunately you will not always be able to setup faces from just a single index. As such you may have to do a preprocessing step that duplicates any necessary data, unless the application, format or api you are working with also supports indexing values separately.


    So if you have vertices normals and uv coordinates, every 3 index values would represent a single vertex, and every 3 groups (of three index values) would define a triangle if the primitive type is triangle list.

  9. #59
    The guy with no life... XD Tcll's Avatar
    Join Date
    Jan 2010
    Location
    the forest of darkness
    Posts
    344
    Mentioned
    0 Post(s)
    Quote Originally Posted by Milun View Post
    Don't get your hopes up though, I'm beginning to doubt my gap theory.
    aww... XD
    Last edited by Tcll; February 13th, 2010 at 05:58.

  10. #60
    EmuTalk Member
    Join Date
    Dec 2009
    Posts
    79
    Mentioned
    0 Post(s)
    And.... I was wrong about being wrong... yay!



    Ok, here's how they work (ignore the red '00', I put them there to shuffle the code to the right). The filled squares are the normal faces (the ones we've deciphered), and the outlines are the new faces. Notice that the new faces are just one row down from the real ones (The purple has a gap because repeats are ignored). I haven't made a code to test it, but I really hope we'll be able to get near gap-less models now.

    Here's my trial with my terrible Game Maker program:



    Edit: There is still one thing I'm not sure of. The isolated purple outline circles the end of one face, however, it's also in the location of the start of another outlined face... I'm not sure whether we should interpret the isolated hex for one face or two.

    The one on the left is the after shot, the one on the right is with the old code. I still haven't perfected my code, which is why there are still gaps, but I think that my above theory is still fine, and the issue is with my code.
    Last edited by Milun; February 13th, 2010 at 08:33.

Page 6 of 51 FirstFirst ... 4567816 ... 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
  •