Results 1 to 17 of 17

Thread: variant_part_mesh converter - one-way decoder available (mostly)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Artifex
    Patrician

    Join Date
    Oct 2008
    Location
    London, UK
    Posts
    1,332

    Default variant_part_mesh converter - one-way decoder available (mostly)

    I tried making a simple .variant_part_mesh parser based on just's research.

    I only tried "type 1" vpms so far, as they're most numerous (about 90% of all).

    File structure is now correctly decoded. just's decoding seems correct so far.

    Todo:

    • Make sure code to decode half-precision floats is correct
    • Make it faster - it's ridiculously slow now (Ruby pretty-printing is the slowest part)
    • Support for "type 0" and "type 2" subformats
    • Converter back
    • Convert each level-of-detail to .obj or some other convenient file format (at least for viewing for now)

    Usage (for now):
    jruby vpm_unpack some_file.variant_part_mesh
    It will print decoded data structure on stdout.
    Last edited by taw; January 31, 2011 at 08:10 PM.

  2. #2
    Artifex
    Patrician

    Join Date
    Oct 2008
    Location
    London, UK
    Posts
    1,332

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    I need your help with something.

    Data for each vertex is this:

    {:position1=>[0.0, 0.0, 0.0],
    :bone1_index=>0,
    :v=>0.95068359375,
    :tangent=>[0.168627450980392, 0.968627450980392, 0.192156862745098],
    :flags=>[0.0, 0.0, 1.0, 1.0],
    :bone0_weight=>255,
    :normal0=>[-0.192156862745098, 0.192156862745098, -0.96078431372549],
    :binormal=>[0.96078431372549, -0.168627450980392, -0.2],
    :position0=>[0.145263671875, 0.0089263916015625, 0.0089263916015625],
    :bone0_index=>3,
    :instance=>0,
    :u=>0.82666015625,
    :normal1=>[-1.0, -1.0, -1.0]},

    That's a lot more than just (position vector, normal vector, texture uv).

    How do I encode this as .obj or some other sensible format?

    Any other format I could use?

    EDIT: .ply seems somewhat more extensible than .obj without being more complicated.
    It should be possible to shuffle extra data like flags/bone indices etc. there.

    But what do I do with each vertex having two positions, two normals, tangent, and binormal?

    EDIT
    : OK, so it seems than Blender and Milkshape3D both support this kind of bone animation. Could someone point me to (or make for me) sample files with tiny animations of the kind we have here, so I could use them to figure out how to write the converter?

    And some instructions how to view them. I'd probably prefer Blender, as it works on all operating systems and it's free, but other programs might work too I guess.
    Last edited by taw; January 31, 2011 at 11:33 PM.

  3. #3
    Primergy's Avatar Protector of the Union
    Join Date
    Mar 2009
    Location
    Augsburg
    Posts
    2,491

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    I've attached a zip with variant part mesh type 1 (unit) with an xml file for the ogre engine and the milkshape format. Sadly i didn't found a converter to the blender file format.

    Hope this helps a bit.

  4. #4
    Artifex
    Patrician

    Join Date
    Oct 2008
    Location
    London, UK
    Posts
    1,332

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    Quote Originally Posted by Primergy View Post
    I've attached a zip with variant part mesh type 1 (unit) with an xml file for the ogre engine and the milkshape format. Sadly i didn't found a converter to the blender file format.

    Hope this helps a bit.
    Wait, which file is it for?

    And why are there multiple keyframes of animation if variant_part_mesh has only two endpoints, plus a pair of vectors to help interpolate between them?

    There's no way to convert these files back, am I right?
    I'm confused.

  5. #5

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    Quote Originally Posted by taw View Post
    Wait, which file is it for?

    And why are there multiple keyframes of animation if variant_part_mesh has only two endpoints, plus a pair of vectors to help interpolate between them?

    There's no way to convert these files back, am I right?
    I'm confused.
    Animations are stored in seperate .anim files in etw. The vpm file does not have an animation in it, nor does it have endpoints or vectors for interpolation. The animations in the .anim files are keyed every frame.

    To make a useful conversion you will have to find a format in which you can store additional information like the shader settings, examples are Collada, FBX or using MaxScript to directly import into 3ds Max. Be aware that the first two are quite extensive(= complicated) formats, and maxscript is bug-ridden.

    To partially convert back from the xml files shown earlier you do:
    Collapse all bones back to 0,0,0 (and undo any rotations as well), because the converters currently out there apply the first animation frame of the reference animation to models, so they look somewhat like they're supposed to look.
    Calculate the binormal and tangent, those are the vectors on the face along respectively the U and V texture coordinates axes, to calculate them for a single vertex instead of for a face just average the direction of all the faces that vertex belongs to (could even make that a weighted average based on face size).

  6. #6
    Artifex
    Patrician

    Join Date
    Oct 2008
    Location
    London, UK
    Posts
    1,332

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    Quote Originally Posted by just View Post
    Animations are stored in seperate .anim files in etw. The vpm file does not have an animation in it, nor does it have endpoints or vectors for interpolation. The animations in the .anim files are keyed every frame.
    vpm doesn't have animations, but that xml Primergy uploaded seemed to have some.

    vpm as for every vertex have two positions, two normals, binormal, tangent, bone indices and bone weights.

    That's a lot more than a static model. I have no idea how to represent such data usefully yet ;-)
    Especially since what we really want is a way to convert back as well.

  7. #7

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    Quote Originally Posted by taw View Post
    vpm doesn't have animations, but that xml Primergy uploaded seemed to have some.

    vpm as for every vertex have two positions, two normals, binormal, tangent, bone indices and bone weights.

    That's a lot more than a static model. I have no idea how to represent such data usefully yet ;-)
    Especially since what we really want is a way to convert back as well.
    No, a vertex with a position, normal, binormal, tangent, bone-attachments, texcoords, and whatever else is in there is very common in 3d models, except for the multiple bones it is all needed for a static model.

    The two positions are only 2 positions when no animation has been applied. When the reference animation (or any other) has been applied there is only 1 position, attached to two bones, the actual position is a weighted average of the translation and rotation of the bones. There is only binormal and tangent information for the first bone, to save space and time at loss of only little accuracy (far less loss than in the horribly wrong lighting calculations in the shaders).

    You could also take a look at the python mesh converters by KnightErrant at http://www.twcenter.net/forums/downl...o=file&id=2619 the variant weighted mesh models are similar to variant part meshes, they are both for animatable units and contain similar information.

  8. #8
    Primergy's Avatar Protector of the Union
    Join Date
    Mar 2009
    Location
    Augsburg
    Posts
    2,491

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    You said you want a tiny animation so i exported those files with a animation "inside" ?

  9. #9
    Artifex
    Patrician

    Join Date
    Oct 2008
    Location
    London, UK
    Posts
    1,332

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    Quote Originally Posted by Primergy View Post
    You said you want a tiny animation so i exported those files with a animation "inside" ?
    It looks like I'll need to investigate existing converters and some 3d editing programs to
    finish this converter - I can do exporting to generic xml now, but it won't be of much use.

    And yes - I have similar problem with regions.esf - I know a lot of things about it
    that I cannot really do much with due to lack of good formats :-/
    (and unfortunately I also discovered regions.esf alone won't open campaign yet,
    fortunately other poeople found a lot of information about other relevant file formats,
    so we might get campaign mods in the end)

  10. #10
    Primergy's Avatar Protector of the Union
    Join Date
    Mar 2009
    Location
    Augsburg
    Posts
    2,491

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    Maybe the easiest method would be to ask the uu3d developer to extend his already exisiting plugin.
    A free converter would be nice in the future, of course.

    For the Regions.esf... i had the theory that ca didn't used things like qgis or others but more something like Adobe illustrator or autocad. Atleast i think those programs are working with vectors, too?
    But maybe this is complete nonsense^^.

  11. #11
    wangrin's Avatar Unguibus et Rostro
    Patrician Artifex

    Join Date
    Feb 2005
    Location
    France
    Posts
    4,397

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    It's certainly irrelevant here, but, as you speak about UU3D, is it possible to fix the "vertex and joints inversion" ?
    It is very annoying because when you convert variant_weighted_mesh to ms3d with UU3D :
    - first, it is impossible to use Knight Errant converter (and lot of people didn't got UU3D) ;
    - second, it is not very easy to create model as it is like looking in a mirror.

    Despite those "problems", UU3D and ETW/NTW plugin are very great tools for modding.


    « Le courage, c’est de ne pas subir la loi du mensonge triomphant qui passe, et de ne pas faire écho de notre âme, de notre bouche et de nos mains aux applaudissements imbéciles et aux huées fanatiques.. » Jean JAURES

  12. #12

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    Converter for elite units of the west, east and america please!

  13. #13
    Inevitability won
    Patrician Citizen

    Join Date
    Mar 2010
    Posts
    9,594

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    This is about variant_part_mesh.. WHICH IS NOTHING TO DO WITH ETW.

    Stop derailing the thread or I start reporting. This is important business.

  14. #14

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    Quote Originally Posted by .Mitch. View Post
    This is about variant_part_mesh.. WHICH IS NOTHING TO DO WITH ETW.

    Stop derailing the thread or I start reporting. This is important business.
    So place for this topic is in NTW.

  15. #15
    Primergy's Avatar Protector of the Union
    Join Date
    Mar 2009
    Location
    Augsburg
    Posts
    2,491

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    Converter for elite units of the west, east and america please!
    Those models are encrypted which means they have a copy protection.
    Cracking this is the same as if you are cracking a game, which is as far as i know, illegal and not supported in this forum.

    ----

    I've talked to Brad (UU3D Developer) about those files and this is his answer:

    Hi,
    NTW part models are somewhat more complex than ETW variants.
    Some data fields are still unknown, so it's somewhat difficult to
    re-create.

    Regards,
    Brad Bolthouse
    This is based on the Justs research, which also taws source. So anyone nows which data fields are still unkown and mabye already knows what those are?

  16. #16
    The Hedge Knight's Avatar Fierce When Cornered
    Artifex

    Join Date
    Oct 2009
    Location
    England
    Posts
    5,875

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    Any news on this? Just as an update belnder comes with a built in .ms3d or .x import (as do many other programs) but comparitly few have a .blend import.

  17. #17
    Artifex
    Patrician

    Join Date
    Oct 2008
    Location
    London, UK
    Posts
    1,332

    Default Re: variant_part_mesh converter - one-way decoder available (mostly)

    Quote Originally Posted by 'The Hedge Knight View Post
    Any news on this? Just as an update belnder comes with a built in .ms3d or .x import (as do many other programs) but comparitly few have a .blend import.
    No news. I've been mostly working on esf-related stuff, ui layout converter (now with a lot more awesome),
    plus briefly on sound data bank (which I hope to open real soon now).

Posting Permissions

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