Page 1 of 3 123 LastLast
Results 1 to 20 of 51

Thread: Python mesh converter for mounts and siege engines

  1. #1
    KnightErrant's Avatar Decanus
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Python mesh converter for mounts and siege engines

    I've updated my mesh converter to include mounts and siege engines.
    The beta version v1_0_0 can be downloaded from here:

    Edit: Updated to version v1_0_1. This fixes errors with some of the skeletons
    and also one bug in the Python script.

    Edit: Updated to version v1_0_2. This fixes the texturing error noted by AlphaDelta.
    Just swaps uv indices to match the triangle swapping.

    Edit: Updated to version v1_0_3. This fixes a bug in the final data section relating
    to secondary bone Ids and vertex weights. The bug manifested itself when a user,
    bdotward, made changes to uv coordinates. These interacted with the error in the
    final data section causing Milkshape to produce truncated .ms3d files upon saving.
    New version can be found here:

    http://www.twcenter.net/forums/downl...o=file&id=1377


    Unzip the files into a directory and then double click the file:
    meshconverter.py. In the file chooser select a .mesh file to convert to
    a Milkshape .ms3d format. To back convert choose a .ms3d extension.
    Note that on the back conversion process a _converted is appended to the
    filename to prevent overwriting the original mesh.

    Do not use this to convert regular units, it has no merge facility. Use
    GrumpyOldMan's converter for these units. This has not been extensively
    tested but here are two conversions:



    This is mount_elephant.lod0 and lod1 (the ears are pulled out and scaled).



    This is the bombard lod0 and lod1 (the barrel is bent).

    Don't mix and match between GrumpyOldMan's converter and this one, we
    haven't made our formats completely compatible. To do mounts requires adding an extra flag after the bounding sphere data under model comments.
    (The flag is either 4 or 2 depending on whether the full tangent basis is required or just the vertex normals.)

    Siege engines do not use the modeldb file to associate texture files; rather, the paths to the 3 texture files are encoded in the mesh. These paths are stored in the joints comments. You can select one of the first three
    joints and hit the comment button to see them in Milkshape.

    Still working on documentation for the mesh format and other elements
    of the conversion process. When completed, I'll post the documentation
    here.

    Please post any bug reports in this thread and I will try to fix them as soon as possible.

    Edit: Forgot the conditions of release: there are none this is released freely as a tool for
    the community. Take it and modify as you see fit. No attributions are required.
    Last edited by KnightErrant; May 17, 2007 at 09:15 AM.

  2. #2
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: Python mesh converter for mounts and siege engines

    This is nice, KE, thanks a lot! I assume your script is different from GOM's because neither mounts nor siege engines were passed through the granny plug-in, nor have variations within the same unit?


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  3. #3
    KnightErrant's Avatar Decanus
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Re: Python mesh converter for mounts and siege engines

    No, mounts and siege engines have the granny strings, it's just that
    siege engines have a variant mesh format that has to be coded around.
    My script tries to follow GrumpyOldMan's conventions everywhere except
    that for mounts, under the model tab comments button you'll see an extra
    entry after the bounding sphere data of either 4 or 2. This is because mounts
    don't follow any real pattern for whether they include the full tangent space
    basis or not for the higher numbered lods. 4 means they do for all lods,
    2 means only the lod0 has the full basis.

    Also, GrumpyOldMan stores something in the filename slots of the
    ms3d materials blocks but I don't know what it is so I just write null data
    there. Mine will convert regular units too but I wouldn't use it for that
    because of these slight format differences. Anyway, without a merge facility
    mine is pretty useless for the stuff you guys are doing with the regular units.

  4. #4

    Default Re: Python mesh converter for mounts and siege engines

    KnightErrant,

    Excellent work. This is the last piece of the jigsaw!

    This is a slightly off topic question, but do you know if it's currently possible to make the game read descr_skeleton.txt? I want to remove the box off the back of the elephant and get my units to kneel (or sit) on the elephants back.

    At the moment the game just wont load the descr_skeleton.txt file for me.

    Cheers
    "I don't want to sit around Windsor because ermm .. I just generally don't like England that much" - Prince Harry, 3rd in Line for the British Thrown



    For King or Country - The English civil wars.

  5. #5
    KnightErrant's Avatar Decanus
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Re: Python mesh converter for mounts and siege engines

    I don't know the answer to that. Just started looking at animations.
    I've modified an extracted .cas and tried to put it in game using
    the no_animdb = 1 or no_animdb = true that Caliban said should work
    but I'm not seeing it. Then tried putting the whole unpacked animations
    in and renaming pack.dat and pack.idx like Caliban suggested but that
    just crashed. Rereading zxiang1983's thread I wonder if no_animdb just
    doesn't work and you have to repack to get modded anims to work in game.

  6. #6
    KnightErrant's Avatar Decanus
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Re: Python mesh converter for mounts and siege engines

    Oops, I've been informed by GrumpyOldMan that I've
    borked some of the skeletons for the siege engines.
    Basically, anything that has a bone named bone_balls
    should be the root bone and not bone_body the way I
    rigged them. Working through this I also noticed that
    the small_ribault skeleton is empty, so I will fix that as well.
    Don't trust myself to do this correctly this late at night so
    I'll try to fix it tomorrow at lunch. Also, the bombard might
    need a fix in code to get a different skeleton, if so, I'll
    release new code for that. Call it version 1_0_1.

    The good news is my QA team will be flogged at dawn.

    The bad new is, I'm my QA team. This could be unpleasant.

  7. #7
    KnightErrant's Avatar Decanus
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Re: Python mesh converter for mounts and siege engines

    I've corrected the errors in the skeleton files and found and
    fixed one bug in the Python script. The URL at the top of the
    thread has the link to the updated files.

  8. #8

    Default Re: Python mesh converter for mounts and siege engines

    KE,

    I've managed to use your coverter to convert medium_horse_lod0.mesh to ms3d. In any M3SD viewport the UV coordinates are shot to pieces, but in the texture coordinate editor the UV's looks fine. Any ideas?

    Cheers
    "I don't want to sit around Windsor because ermm .. I just generally don't like England that much" - Prince Harry, 3rd in Line for the British Thrown



    For King or Country - The English civil wars.

  9. #9
    KnightErrant's Avatar Decanus
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Re: Python mesh converter for mounts and siege engines

    @AlphaDelta
    I'm seeing that too. Let me take a look, I know
    we have to switch triangles to get the .ms3d format.
    Bet I didn't switch the UV coords to match.

  10. #10
    KnightErrant's Avatar Decanus
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Re: Python mesh converter for mounts and siege engines

    Ok, I've fixed the texturing problem. Edited link at top of thread
    to point to meshconverter_v1_0_2.zip.



    FYI, you should only work on mount units that start with mount_ because
    they are the only ones in the modeldb file. medium_horse.lod0, for instance,
    isn't found in the file. Plus, my code depends on finding the partial
    string "mount_" for horses, "mount_camel" for camels, and "mount_elephant"
    for elephants, otherwise it will fall through and use the standard human
    skeleton. This will put the wrong bones back into the mesh on the
    back conversion.

  11. #11

    Default Re: Python mesh converter for mounts and siege engines

    great work KE!
    i'll see what type of modifications can be done to them there mounts!

    cheers
    -indian_boy
    CHECK ME OUT ON YOUTUBE
    for Total War Tips, Tricks and Tutorials!


  12. #12
    B. Ward's Avatar ★★★★ RockNRolla ★★★★
    Join Date
    Feb 2007
    Location
    East Coast, United States
    Posts
    4,376

    Default Re: Python mesh converter for mounts and siege engines

    i have a question ke. for some strange reason i only get a txt document when i try to convert back to the mesh format. and i doing something wrong?

  13. #13
    KnightErrant's Avatar Decanus
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Re: Python mesh converter for mounts and siege engines

    Sorry, was off the air for the whole weekend. The .txt file is just
    debugging output, so the script is probably bombing and then the
    DOS box is disappearing. Try running it this way: open a DOS box
    or command window and cd to the directory with the meshconverter.py
    script. Type python to start the interpreter, then type
    import meshconverter ( or import meshconverterv1_0_2 for that version).
    This should leave the command window open after the script runs and
    if it crashed it should leave an error message with a line number for the
    last command it was able to process. If you could post what it says
    and what file you were trying to convert I'll take a look at it. I appreciate
    the bug reports because I can't test stuff without them.

    Many thanks,

    KE

  14. #14
    B. Ward's Avatar ★★★★ RockNRolla ★★★★
    Join Date
    Feb 2007
    Location
    East Coast, United States
    Posts
    4,376

    Default Re: Python mesh converter for mounts and siege engines

    thanks for your response this is what it says when i get the command prompt not to bomb.


    i'm trying to convert mount_barded_horse model back.

  15. #15
    KnightErrant's Avatar Decanus
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Re: Python mesh converter for mounts and siege engines

    @bdotward
    Many thanks for the dos box screen shot. I think I can read line
    5133 in ms3dtomeshconverter but can't quite make out line 2 something
    something for dummy = getuint( fidms3d ) but I think I can track it down
    with what you've given me. Will try the mount_barded_horse conversion
    back and forth and see if I can reproduce it. It might take a day or two,
    work is kinda hectic at the moment.

  16. #16
    B. Ward's Avatar ★★★★ RockNRolla ★★★★
    Join Date
    Feb 2007
    Location
    East Coast, United States
    Posts
    4,376

    Default Re: Python mesh converter for mounts and siege engines

    pish posh....thank you my friend...we all actually have lives outside of the game. i'm glad i could bring it to your attention. take your time, my life will not come to an end. i'll report any other bugs if i find them.

  17. #17
    KnightErrant's Avatar Decanus
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Re: Python mesh converter for mounts and siege engines

    The bug in the final data section has been resolved. A link to
    version v1_0_3 has been added at the top of the thread which fixes
    this bug. Many thanks to bdotward for both reporting the bug and
    doing the testing which resolved the problem.

    Quick note about mounts: Only the horse, camel, and elephant units whose
    names contain mount_ at the beginning are in the modeldb file and are the
    only mount units used in game. These are the only ones the script checks
    for. If you try to convert any of the other mount units they will wind up
    with human bones in them. They will back convert and play in-game but the
    animations will be both amusing and disturbing. Word to the wise.

  18. #18

    Default Re: Python mesh converter for mounts and siege engines

    srry, mistake

  19. #19

    Default Re: Python mesh converter for mounts and siege engines

    Help .... my mounts are exploding!

    Or, rather, the riders are. I tried replacing the horse mesh with a custom undead horse model, but I cannot get it to work no matter what I do. The model converts OK and I get a viable mesh that doesn't crash the game ...but it has major issues.

    The riders are missing...except for the general model. Also, I have a mess of polgons that seem to radiate out from the rear of the horse ( below ground level ) which may be the remains of hte rider. ... but are textured so they look like a bit of the horse gone wrong.

    The rigging is all correct, and I even tried assigning ALL the bones to the saddle bone to make sure I had everything assigned to a steady point. No...same. In the MESH thread over at the Org, there was another post from someone with identical issues .... but no answer as to what had caused it.

    I'm baffled

  20. #20
    KnightErrant's Avatar Decanus
    Join Date
    Jan 2007
    Location
    Huntsville, Alabama USA
    Posts
    578

    Default Re: Python mesh converter for mounts and siege engines

    @Bwian
    I know FedeITA had the exploding textures with version1_0_2 like you're describing. I sent an updated version to test but didn't hear back.
    bdotward was able to get a good mount in-game with v1_0_3 which fixed
    a problem with secondary bone Ids and weighting. Which version are you
    using which has the problem?

    Edit: Just to check, you said custom horse. Did you start by converting over
    one of the in-game mounts so that you get the horse skeleton? I know one
    problem I've seen before is if someone tries to convert one of the mount units
    whose name doesn't start with mount_. The converter doesn't trap the name
    and it defaults to using the human skeleton thinking it must be a regular unit.
    Last edited by KnightErrant; May 22, 2007 at 08:34 AM.

Page 1 of 3 123 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
  •