How to isolate pieces of a msh p1 Piece Removal

Started by tirpider, June 18, 2012, 07:22:32 PM

Previous topic - Next topic
June 18, 2012, 07:22:32 PM Last Edit: November 02, 2012, 08:01:28 PM by tirpider
HOW TO ISOLATE PIECES OF A MSH
(without using a model editing program)


WARNING:[spoiler]
The following method is long and a bit confusing at times.
It uses custom tools I built specificly for this.
It requires several programs and sometimes switching back and forth between them.
I am proud of the results, but I have to admit, it is way over complicated for what it does.
I just wanted to let you know what you are stepping in.

I Have to call these walkthroughs, because they really don't teach how to modify models as much as they show how I do it.

A side note: If you can follow along and 'get it' and have a better way to explain something, feel free to comment. I'm always open to suggestions, especially if they can help clarify a point.
If you don't 'get it' then please ask questions. I'll try to answer as direct as I can.
If you think this method is awful, let me know. We can all work together to find better ways to get what needs to be done accomplished.[/spoiler]



The following 5 walkthroughs will explain how to isolate and remove geometry from SWBF msh files and optionally make an addon msh or add them into other msh files.

It is very simular to hex-editing, but there are tools inplace to help eleminate some of the basic errors that hex editing is plagued with.

The benifit to this method, is that it allows for editing the msh files (and even kitbashing, to some degree) while maintaining all the nulls that would be lost using existing converters.

Some of the process is rough around the edges, some of it is incomplete. All of it is made up as I go. :)
Once you get the flow down, it isn't as involved as I make it out to be.  But it is a little tricky at first.

It involves hex-editing, munging, file and folder managment, spreadsheet work, and a little image editing.
I'll try to be as complete as I can, but it's easy to get hung up on any of the above.
Hopefully we will all be masters of all the above by the time this is done.

In this thread I will do (cut up) 5 examples. Each has a bit different method.
I focus on units, because that's what I have studied and they seem the most involved.

  • Piece Removal: Remove the backpack from: BFBuilder\Assets\Sides\IMP\MSH\imp_inf_shocktrooper.msh
    This method is good for removing pieces from an existing MSH.

  • Adding A Piece: Place the same backpack onto another unit.
    This is my method for "hex editing" chunks onto other units.

  • Make An Addon: Make the above Backpack into it's own msh (for use as an addon msh)

  • Extraction: [not done]<Isolate a part of a mesh thats embedded in another><subject to be determined>
    This is pure magic in the most conveluted manner possible.

  • Manipulation: [not done]<move and scale pieces>
    This is an insane adaptation of the Extraction magic.



-edit
I'm sorry, but I have canceled the last 2 portions of this guide. The first few are still good for basic tasks, but the last two are too much for me to explain.  More info at the begining of the Extraction post.
end edit




EXAMPLE 1
remove the backpack from: BFBuilder\Assets\Sides\IMP\MSH\imp_inf_shocktrooper.msh

We are going to take the shocktrooper's backpack off.
You can use the same method to take any named MODL off a MSH.
The difference between doing this to a unit and doing it to a prop is that the unit has an array of nulls(the skeleton) that must be left in place.


Basic Process:

  • Workspace Setup
  • MSH Teardown
  • MSH Modification
  • MSH Test


Tools Needed:[spoiler]
The following tools need to be installed and working.

  • Hex Editor : Freeware Hex Editor XVI32
    We'll actually be spending very little time in the hex editor.

  • Image Editor : Paint.NET
    I don't know GIMP or Photoshop, but they will work as well. In fact, for the purposes of this how-to, ms paint should work, as we won't be doing anything creative.

  • Spreadsheet : OpenOffice.Org Calc
    Only needed if you are going to be pulling msh data out of a SEGM or moving or scaling a mesh.

  • SWBF Mod Tools(BFBuilder, assets, ect) : SWBF Mod Tools
    For testing the finished product.

  • Tim Skillman's MSH Viewer : SWBF MSH Viewer
    For visualising all the msh data.

  • my msh toolkit : pre-alpha_msh_kit.zip
    Some customized tools that are tailored for this process. They are simular to other tools I have made, but these are newer, better, and will constantly be changed to make this process easier.

  • AutoIT : AutoIT
    I wrote the tools with this scripting language and the scripts that make changes to geometry require the autoit environment to run.
    If you are just moving chunks around, then there is no need for it, but if you are cutting pices out of SEGM's, then it's required.
    A cool addition to the AutoIT download, is the SciTE editor. It has native context highlighting for Lua.

[/spoiler]


References:[spoiler]

  • MSH file format information
    [info].msh structure notes
    [pic]Standard Unit 'Skeleton' Chains
    These 2 links describe a bit about how the information is organized in the msh files.
    A good way to see the info in action is to load a msh into the MSH INFO TOOL in the tool kit and see how your favorite msh's look in it
  • <links to more information>
[/spoiler]


Detailed Instructions:
Before Doing Anything:[spoiler]
We need to know if the piece we want is in a chunk, by itself, or imbedded in another piece.
We can get to them all, but if it isn't by itself, it will be a more complex operation.
I'll cover each, in time.

  • There is a program named "SWBF_MSH_INFO.exe" in the toolkit.
    Run it and load the msh you want to look at.
    (It loads the msh using BASIC like structures, so it is quite slow.)

  • When it's loaded, expand "HEDR" in the treeview on the left. Then expand "MSH2".
    You should see all the MODL chunks and thier names.

  • Look for a name that resembles what you want. (we're looking for the shocktrooper's backpack, so scanning through the names finds "Imp_inf_Trooper_Backpack". Bingo.
    We're in luck, it's in it's own chunk ank we're going with that for now. (I'll make another post in this thread that goes into how to get the geometry un-embedded from a chunk)


  • Thats it. We just needed to know what were looking for when we cut the msh into chunks, and I just wanted to show you how to look in a msh without a hex editor.
    There will be an additional post on how to find it if it isn't named.

[/spoiler]


Workspace Setup:[spoiler]

  • Make a project folder with a descriptive name. I'll call this one "shocktrooper_nopack".
    So, I need to create a folder named "shocktrooper_nopack" somewhere.

  • In that folder, create another folder named "sources"
    This is where we will keep our references, and source materials. Once you put something in sources... don't edit it. It's your primary backup of source materials.

  • We are working with the imp_inf_shocktrooper.msh, so go into your sources folder and create afolder named "imp_inf_shocktrooper".

  • Now go get the files for him and copy them to your projects sorces folder. All the files. TGA's, .options, msh's.

  • Extract the toolkit into your project folder or copy the "_tool" folder over.
    The _tool folder should be next to sources, but were going to move it again anyway, so , just as long as it's here.



[/spoiler]


MSH Teardown:[spoiler]

  • In the _tool folder there is a program named MSH2chunks.exe. Run it, and browse to the imp_inf_shocktrooper.msh in your sources folder.
    A console should pop up, with a bunch of stuff scrolling by, that this program chopping the msh into individual tags and folders.
    When it is done, you will have a new folder named "imp_inf_shocktrooper.msh_chunks" in the folder containing the msh.

    This has exploded all the tags into a very accesable array of folders.
    If you are familier with hex editing already, then you will probably find a lot of uses for this tool and it's couterpart, chunks2MSH.exe.

  • Move the _chunks folder to the root of your project folder and give it a working name. (Renaming is optional, but I find it helps me remember when I revisit old projects.)
    I'll call this "_nopack".
    This will be your primary work directory.

  • Move the _tool folder into the _nopack folder


  • Inside the _tool folder is a BuildIt.bat file.
    Copy it to the _nopack folder

  • Now, copy the TGA files from the sources folder to the _nopack folder.

  • run the Buildit.bat from your work directory (not from _tool).
    This will rebuild the msh file from the folders of tag chunks.
    It will ask you to press a key in the console when it is done.
    The finished file will be named tst_inf_tst.msh , and will be overwritten each time the buildit.bat is run.
    I always run the buildit.bat once before making any changes, then load the msh into the viewer.
    If is shows up and acts the same as the original msh, then I know everything is set up and ready to go.

    (after running BuildIT.bat)


[/spoiler]


MSH Modification:[spoiler]

  • Find Chunk folder
    Remember the name of the MODL chunk? (Imp_inf_Trooper_Backpack)
    Look in the _nopack folder for the numbered folder that has Imp_inf_Trooper_Backpack in it's name.

  • Move Chunk folder
    When BuildIT.bat is run, it creates a _recycle folder.
    This is to be used as a temporary space to hold chunks. (Chunks2MSH will ignore this folder and everything in it.)
    Move the Imp_inf_Trooper_Backpack chunk folder to _recycle.
    Don't just delete it.
    The point of this folder is simular to the recycle bin.
    You can delete it, but if it turns out you need something from here later, you have to tear down the MSH again to get it.
    I always save the recycle and tool folders as the source for my projects.

  • Run BuildIT.bat
    This will rebuild the msh from the remaining folders.
    Load it into the MSH viewer and see what you have done :)
    You should see the trooper without his pack.
    Almost done.

[/spoiler]


MSH Test:[spoiler]
Now the msh needs to be tested.
There are 2 basic tests: Use the viewer and Munge it.

Use the viewer
Loading into the viewer is a quick way to see what you are doing.
The viewer is unreliable in some regards. But for removing chunks it is fine.

Munge it
This is just putting the msh into a project in bfbuilder, munging, and testing it out.
Sometimes the viewer doesn't display things the way they will be in game, so it's a good idea to have a very basic test map dedicated to testing things out.
To test the MSH, you need everything for it. The .options, the odf's, if it needs to be called in a req, or have special animations, they all need to be prepared as well.
Ideally, you already have all that in the sources folder.
Setting up odf files and such is really a whole different ballgame than hex-editing msh's so I leave it to you to explore the tutorials, documentation and forum for that information ;)

A quick trick I use is that I already have the test world set up and all the odf's and lua prepared to accept a tst_inf_tst.msh.
So all I have to do is drop the MSH and it's files in the MSH folder of a side, munge and go.

If you are not satified with the tests, then it's back into the work folder to see what went wrong.
I don't have a trouble shooting guide for this, so you'll have to ask questions and figure a lot of stuff out.
(I'll answer as best I can)
If it works in the test level, then you are done.
There is still a shadow left, but that's a different tutorial.
[/spoiler]

Rename the msh from tst_inf_tst.msh to whatever suits you and do as you will with him :)

Done.

Example Files (5 mb rar)

-Some things left to do
--The shadow of the pack will still be there.
--Each MODL has a MNDX number. If there are duplicates, things wont work right. But It can handle a missing number.
--This can be done to the lowres model of the same unit for completeness.

/end EXAMPLE 1

In the next one we will put that backpack on another unit.

Get well soon. I look forward to this very much.

:sick::(

June 23, 2012, 08:24:41 AM #2 Last Edit: June 24, 2012, 01:29:18 PM by tirpider
EXAMPLE 2
Place a backpack onto rep_inf_ep3trooper
Same as before, but this time we will add a piece.
Specificly, we will add the backpack from the Imperial ShockTrooper, to the EP3 Clone Trooper.




Basic Process:

  • Workspace Setup
  • MSH Teardown
  • MSH Modification
  • MSH Test


Detailed Instructions:

Before Doing Anything:[spoiler]
This is going to assume you followed the previous tutorial, to some degree. <link to previous tut>
The same tools are required, and the process is very simular.

[/spoiler]


Workspace Setup:[spoiler]

  • Create a project folder
  • In that folder, create a folder named "sources"
  • Copy the "_tools" folder from the MSH Kit to your project folder
  • Gather the msh and tga files for the rep_inf_ep3trooper and place them in a folder under "sources"
  • Gather the msh and tga files for the imp_inf_shocktrooper and place them in a folder under "sources"
  • You should have something like this:



  • Make a folder under "sources" called "backpack"
  • Now we need to get the backpack.
    go to the _tool folder and run MSH2chunks.
    Open the imp_inf_shocktrooper.msh and let it cut up the file.
    Now run SWBF_MSH_INFO.exe and open imp_inf_shocktrooper.msh
    Find the backpack MODL chunk and click once on it.
    Make a note of 2 things. The bone it is parented to (PRNT) and the material it uses (MATI)

    Close the info tool.
    browse to the imp_inf_shocktrooper_chunk folder and look for the backpack MODL chunk folder.
    Move it to the backpack folder you created earlier.
    Now look for the material folder that corresponds to the material the backpack uses.
    It was MATI 2 so we ar looking for a folder that has MAT_2 in it's name.
    Move it to the backpack folder you created earlier.
    copy the tga for the backpack (and it's option files) to the backpack folder.
    It's now ok to delete the imp_inf_shocktrooper from your sources.
  • You should have something like this:


[/spoiler]


MSH Teardown:[spoiler]

  • Run MSH2chunks.exe from the _tool folder and open the ep3 trooper msh.
  • When it is done slicing it up, move the _chunks folder it created to the root of your project folder.
  • This is a good time to pick a unique name for the msh. I'll call it "rep_inf_ep3trooper_wpack"
    Boring, but descriptive.
    Rename the _chunk folder
  • Move the _tool folder to rep_inf_ep3trooper_wpack.
  • Copy the BuildIT.bat file from the _tool folder, into rep_inf_ep3trooper_wpack
  • Copy the tga files from your sources folder to rep_inf_ep3trooper_wpack
  • Run BuildIT.bat once
  • Open the tst_inf_tst.msh with the msh viewer. It should look the same as rep_inf_ep3trooper.msh.
    (If the first tst_inf_tst.msh from a project doesn't look like the source, either you did something wrong, or my program did. Post or PM me and I will figure it out :) )
  • After the first run of buildit, your folder should look like this:

[/spoiler]


MSH Modification:[spoiler]

  • COPY the contents of the backpack folder into the _recycle folder.
    (we will make changes to it here instead of in the sources in case we make a mistake)

Getting the backpack on is as simple as dropping the folder in and running buildit.
I always try to find a way to put additional geometry at the end of the skeleton chains.
Sometimes you have to renumber a lot of MNDX's to fit a piece in.
I've had some good luck just dropping pieces in at the end.

Notice the nubers at the begining of all the folder names that MSH2Chunks created.
Those keep all the pieces in order and are created by the program dynamicly.
Chunks2MSH rebuilds the msh using those numbers to sequence the pieces.
All the MODL pieces need to be contained in the MSH2 section, so we need to number the backpacks folder so that it falls at the end of it.
I had the program start numbering chunks from 996 for exactly that reason.
All the chunks numbered 996 and higher are not part of MSH2, so we can number our backpack folder after the last null.  (600_____51_eff_l_toe)

  • Renumber the backpack folder in _recycle so that it starts with 610
    (I leave gaps in the numbers in case I need to add something inbetween)

There is another number we need to change. The MNDX.
MSH's use MNDX to identify MODL chunks internally.
A lot of hex-edits before would fail because the MNDX was the same as another MODL in the MSH.
We are adding to the end of the MODL sequence, so we just need to check the MNDX of the last MODL and add 1 for our backpack.

  • Browse to the last MODL chunk folder.(600_____51_eff_l_toe)
  • Open the MNDX chunk file in a hex-editor
  • Translate the number in it's data area to a long integer
    In XVI32, click once on the first byte of the data portion and look on the data inspector for longint.

    The last MNDX is 51, so our backpack need to be 52.
    Close the hex-editor.
  • Browse to the backpack folder and open it's MNDX chunk file.
  • Click once on the first character of the data part
  • DOUBLE CLICK on the longint entry for it on the data inspector.
    (this will bring up the Encode Number dialog.
  • Make certain that the options "longint" and "overwrite at current address" are selected
  • Type 52 in the space provided

  • Press OK, save the file, and close the hex-editor

Now we need to put the Material for it in place.
The same initial numbering applies to Materials.
The existing materials are numbered 40 and 41, so our backpack material needs to be 42.
Then the material count needs to be updated, and the MATI for the backpack needs to be changed to reflect the new material's position.

  • Renumber the Material foder for the backpack to 42
  • Browse to the "039_MatCount" folder
  • Open the MATL chunk and change it's data from 02 to 03

  • Save and close the hex-editor
  • Open the MATI chunk in the backpack folder and make sure it's data value is 02
    (Materials are numbered from 0 in the msh)

  • Save and close the hex-editor
  • Move the Material and MODL folder, and the TGA for the backpack, to the project folder.
  • Run BuildIT.bat
  • Load it in the viewer to see if it looks right.
[/spoiler]


MSH Test:[spoiler]
After each edit (each run of buildit.bat), load in the viewer, to see that everything is going well.

Periodicly, munge your test msh to see that it is actually working in-game.
[/spoiler]

Rename the msh from tst_inf_tst.msh to whatever suits you and do as you will with him :)

Done.

Example Files (5 mb rar)

-Some things left to do
--The shadow of the pack is not there.
--This can be done to the lowres model of the same unit for completeness.
--Th filenames of the material tga's could be altered so that this guy doesn't have to share a skin with a normal trooper.

Next:
Make An Addon: Make the above Backpack into it's own msh (for use as an addon)

June 24, 2012, 01:32:34 PM #3 Last Edit: July 10, 2012, 08:39:39 PM by tirpider
    EXAMPLE 3
    Make An Addon
    Specificly, we will make an addon msh out of the backpack from the Imperial ShockTrooper in the previous examples.


    Basic Process:

    • Workspace Setup
    • MSH Teardown
    • MSH Modification
    • ODF Setup


    Detailed Instructions:

    Before Doing Anything:[spoiler]
    This requires the same tools as before.
    Always work from copies.
    Backup your progress and test often to illuminate errors as soon as possible.
    Ask questions if you get stuck.
    [/spoiler]


    Workspace Setup:[spoiler]
    We could use the material and mesh folders from the previous examples, but it is actually easier to remove the unwanted bits from the doner msh.


    • Create a project folder

    • In that folder, create a folder named "sources"

    • Copy the "_tools" folder from the MSH Kit to your project folder

    • Gather the msh and tga files for the imp_inf_shocktrooper and place them in a folder under "sources"

    • You should have something like this:


    [/spoiler]


    MSH Teardown:[spoiler]
    Pretty much the same as example 2 with the names changed to be relevant to this example.

    The nature of all the edits don't really leave a lot of opportunities to test the msh by running buildit and checking in the viewer, so you just have to follow along till the end, and try to diagnose from there if there are any problems.


    • Run MSH2chunks.exe from the _tool folder and open the imp_inf_shocktrooper.msh in the sources folder.

    • When it is done slicing it up, move the _chunks folder it created to the root of your project folder.

    • This is a good time to pick a unique name for the msh and rename it's _chunk folder.
      I'll call it "ADD_Shocktrooper_Backpack"



    • Move the _tool folder to ADD_Shocktrooper_Backpack.

    • Copy the BuildIT.bat file from the _tool folder, into ADD_Shocktrooper_Backpack

    • Copy the tga files from your sources folder to ADD_Shocktrooper_Backpack

    • Run BuildIT.bat once

    • Your project folder should now look something like this:


    • Open the tst_inf_tst.msh with the msh viewer. It should look exactly the same as the source.

    [/spoiler]


    MSH Modification:[spoiler]
    This is mostly deleting folders.
    If you accidentally delete to many or the wrong folder, you will need to go back to the previous step and run msh2chunks on the source msh again.

    • Delete animation chunks.
      The animation chunks are at the end.
      They are named SKL2 BLN2 and ANM2

      Keep CLIL. I don't know what it does, (it contains no data at all) but it has to be there for the msh to work.

    • Identify the backpack and dummyroot modl chunks.
      This is as easy as checking the folder name.


      When deleting folders, DON'T delete these.

    • Delete all other MODL chunks except for the DummyRoot and the backpack.
      The MODL chunks start at folder 100 (usually DummyRoot).


    • Identify the material used by the backpack.
      Go into the backpack's MODL folder and open it's MATI with a hex editor.
      The value we are looking for is the 4th from the last byte.
      (It will say 02)
      So we need to keep material 2.
      I'm going to jump ahead here... After we delete all the un-needed materials, the new MATI will be 0.
      Change the 02 to read 00.
      Save and exit.

    • The Material numbers are in the Mat foldername just after Mat_
      Delete all except the one that reads Mat_2
      (MatCount is not a material, just a count of them, so don't delete it.)


    • Ok. All the pieces are in place. All that is left is to change a couple of settings.
      - The MATI needs to be updated. (We already updated the MATI 2 steps back.)
      - The Material Count needs to be updated.
      - The MNDX needs to be updated.
      - The PRNT needs to be updated.

    • Update the material count by going into the MatCount folder and opening the MATL chunk file with your hex editor.
      It will have the old count of 5.
      We only have 1 material, so change the 05 to 01
      Save and exit.

    • Next is Updating the MNDX (the MODL index)
      The indexex for MODL chunks start with 1 and increment by 1 for each MODL.
      The first MODL is DummyRoot
      The Backpack is the second (and last) MODL, so it will be 2.

    • Go into the MODL chunk folder for the backpack and open the MNDX chunk file with your hex editor.
      The value we need to change is starts at the 9th place (like most of the tags we've been changing.)
      It is a long integer so it will look like 27 00 00 00
      Placing the cursor at it's first byte and reading the longint line on XVI's data inspector translates it to it's real value (39).


      We need to change this to read 2, so...
      Double click on the longint value to bring up the Encode Value dialog.
      Make sure the longint and the Overwrite at current address options are selected.
      type 2 in the Number field and press ok.


      Save and exit.

    • Last is the PRNT (parent) chunk.
      The PRNT tells the game what MODL to attach the current MODL chunk to.

      Open the PRNT chunk with your hex editor.
      You can see that this chunk is meant to hang on the bone_ribcage (we will need to know that later, so remember it or write it down somewhere.)
      Since there is no bone_ribcage in this model anymore, we need to attach it to DummyRoot.

    • Place your cursor at the begining of the string and select Edit > Insert String frm the menues.
      Make sure the Text String option is selected and type DummyRoot in the space provided.

      Press ok

      Leave your cursor where it is and press the delete key to remove the remaining characters from the string.
      Leave the 00's at the end.


      Strings in msh files need to have a length that is a multiple of 4.
      Not all strings are that long, so they are padded with null values (00)
      DummyRoot is 9 characters long, so it needs to be padded with 3 nulls.

      Delete one of the remaining nulls, then save and exit.


    • Thats the last of the msh edits (unless something went wrong)
      Run BuildIt.bat and check the tst_inf_tst.msh with the msh viewer.
      It should look like this:

      If you want to see it with a texture, copy the Imp_inf_trooper_pack.tga from the shocktrooper source folder.

    [/spoiler]


    ODF Setup:[spoiler]

      The backpack is attached to a unit just like a cape.

      Add the following code to the ODF of the unit you wish to attach it to.
    [/list]
    AnimatedAddon    = "CAPE"                      // Can be anything. I just leave it as cape.
    GeometryAddon    = "ADD_Shocktrooper_Backpack" // the name of the msh
    AnimationAddon   = "imp_inf_vader_cape"        // See NOTES below.
    AddonAttachJoint = "bone_ribcage"              // where to attach the addon. Should be the same as the original PRNT


    NOTES
    AnimationAddon = "imp_inf_vader_cape"
    That line is a mystery to me in that I could not get the addon to work until  this was added.
    Of course the backpack doesn't have an animation.
    I tried leaving it empty with a "" value, but that just crashed the game when testing.
    If you guys have any insight into this issue, or if I am doing it wrong, please, let me know.

    [/spoiler]

    Done.

    Rename the tst_inf_tst.msh to ADD_Shocktrooper_Backpack.msh (or whatever you decided to call it,) and pair it with the Imp_inf_trooper_pack.tga and the above ODF settings and enjoy.


    A half finished Tusken Raider taking his new Shocktrooper Backpack out for a picnic.
    Example Files (5 mb rar)

    Next:
    Isolate a part of a mesh thats embedded in another

    July 10, 2012, 08:52:53 PM #4 Last Edit: July 14, 2012, 05:14:58 PM by tirpider
    -edit by tirpider
    This post is just me doubting my abilities and figuring out where to go from here.
    The real EXAMPLE 4 begins a few posts down.

    [spoiler]WIP
    man...
    Sorry for dragging all this out.
    The 3rd one is done, and using the techniques in the above 3 walkthroughs, you can acomplish quite a lot.
    In fact, I recomend playing around, make addons out of belt pouches/backpacks and other pieces you find, to get used to the tools and the process before continuing with these last 2.
    I say that, because I'm still fine tuning the next processes and am not sure I even have words for some of the things that will need to be done. (such is the way of voodoo, I suppose)


    -edit...
    Stuck.
    I am looking for a piece to extract to use as an example.
    I was going to  take the backpack off a battle droid, but the UV's are so wierd and overlapped, it doesn't really lend it'self to being explained.

    The easiest is to remove a head, but I was hoping to do something a little more useful.
    I'm still looking, If ya'll have a suggestion, pm or post.
    I'll try to find something soon.

    -edit
    Ok, I found 2 easy ones.
    The earpiece on the Rebel Snowtroopers head, and his belt pouch.
    Don't know which I will go with, but both could be removed to give the unit a diferent feel for re-skinning, or made into addon's for another unit.
    And both are trapped inside the SEGM of a MODL chunk and evade easy removal/extraction.




    I'll run through both independantly and see which is better suited for a walkthrough.
    I'll probably start typing it up sometime tomorrow.

    -edit
    I'm going through this offline, and it is becomming apearant that the last 2 are going to be a LOT more involved as far as set up is concerned.
    I will probably break it into smaller pieces, like Example 4.1, 4.2, ect...
    I should really be keeping these comments and notes to my self, but I know there a couple of you that are looking forward to this next part, and I wanted to keep you abreast of how soon it will be ready.

    In fact, I'll keep this post as is, and start a new one when the walkthrough begins
    I'm toying with the idea of making this a screencast tutorial. I'd have to find a mic.

    -edit
    OK
    I decided to go with the Video walkthrough.
    There are to many steps that are vague in this one and I feel that I could talk or point-and-click the way to do it.
    I'm looking at CamStudio to do it, and I'll try to keep the file size down so I can upload them here instead of using youtube.
    Never done anything like this before, so I'll have to take time to learn the buttons and limits of the new program.

    In the mean-time, if the first 3 walkthroughs are helping or if any points need clarification, speak up and I will try to illuminate the gray areas.



    For now, here is how I am laying out the sections:


    • INTRODUCTION - describe the overall goal of the walkthrough, and identify how this can be usefull to modding other projects

    • PRE-REQUISITES - go over the tools and knowledge needed to acomplish the goals laid out in the introduction

    • INITIAL SETUP - gather resources and assets together

    • ENVIRONMENT SETUP - get folders and tools ready

    • MODEL SETUP - prep the model so that it will work with our build tools and visualization aids

    • PREPARE REIGON MAP - create the uv maps, load them into Paint.net along with the texture

    • DEFINE REGIONS - mark off discrete, continuous areas in a new layer of the region map. mark off the specific area of interest if needed.

    • LOAD THE SPREADSHEET - use the info tool to copy information into the spreadsheet. Also copy coordinates for regions to the spreadsheet. (perhaps 2 seperate sections here)

    • PREPARE AND TEST THE CUTTING SCRIPTS - copy the code from the spreadsheet to the DATA.au3 script. Check that _ChunkBuilder.au3 is set up. preform a test build and test the msh.

    • SET THE CUT DATA - (no words for this. It's an array of copy paste movements in the spreadsheet)

    • PREFORM EDIT - Load the cutting script, run, build, and test.

    • ... should be done at this point - rename files and done.

    • ROOM FOR IMPROVEMENT - suggestions on what else to do to improve edits like this.

    [/spoiler]

    You absolute star, this tutorial is amazing gravy. 
    I really must find the time to follow it as I need to remove the back-packs from the SWBF2 Alliance side.

    Quote from: Unit 33 on July 13, 2012, 02:14:25 PM
    You absolute star, this tutorial is amazing gravy. 
    I really must find the time to follow it as I need to remove the back-packs from the SWBF2 Alliance side.

    This makes me happy :)

    The tools and technique work with lowres msh's as well.
    Unfortunately, I have no easy way to do anything with shadow volumes. (sv_ MODL chunks)

    But having units with matching lowres is pretty good concidering the nature of it all.

    July 14, 2012, 03:55:16 AM #7 Last Edit: July 14, 2012, 04:17:39 AM by Unit_33
    So I have started with the SWBF 1 Soldier.. and I can't seem to find the chunk responsible for the back-pack? It doesn't seem to be named anything obvious.
    I moved "043_Mat_3_All_inf_trooper_packs.tga" into recycle, which gets rid of the textures thus leaving the model with a big white, textureless back pack... but the chunks are hiding from me.
    Otherwise I now understand how all this lark works, as I've found the time to follow you tutorial :).

    Sorry if I'm being an idiot and missing something in-front of me.

    Quote from: Unit_33 on July 14, 2012, 03:55:16 AMOtherwise I now understand how all this lark works

    heh
    You can see how I struggled to explain it then :)

    On to the backpack.
    You aren't missing anything.
    The chunks don't always have descriptive names and that IS annoying.
    But it isn't the end of the road.

    I know 2 ways to find it.

    1 - guess.
    Just pull a chunk out temporarily, build it, and see what is missing.
    If it is the wrong one, put it back and try another.

    2 - load it with a program that can load msh files AND lists the MODL chunk names.
    I use the shareware version of 3D Object Converter for this. (link)
    It has some issues with 3rd party msh files, but a lot of stock msh files load without a problem.

    Anyway.. A quick screenshot of 3DOC:
    [spoiler][/spoiler]
    The arrow is pointing at the button to turn the object and material selector on or off.
    The names in the object selector are the names of the MODL chunks.
    If a MODL has more than one SEGM, it will show up as "3D_Object" in the object selector.
    Clicking once on each of the items under 3D Scene will highlght the object.


    If you run across a msh that won't load in 3DOC, sometimes you can move the shadow volume (sv_*) to recycle, build and load.
    Just remember to put it back in when you are done viewing.
    Doesn't always work, some msh's need to have small errors fixed befor 3doc will recognize them.
    They are to numerous to list, really, but I can provide workarounds and patches for them as they come up.


    Aha! Now that works like a dream. I have now edited a model. Oh joy!

    Thanks!

    Groovy!

    If you have any suggestions about either the method or the tools themselves, feel free to suggest.
    They are a constant work in progress and I try to tailor them to my style of editing. But I'd really like them to become self explanitory someday with user friendly options.

    July 14, 2012, 03:14:12 PM #11 Last Edit: July 14, 2012, 03:19:02 PM by Unit_33
    Ok... but what about pieces of msh which don't seem to have a single chunk?
    For instance the low resolution model for the Alliance Soldiers' back pack is contained within the same chunk which deals with the body.

    Similarly the SWBF2 Alliance Soldier's back pack shares chunk with various bits and bobs...

    Does this fall under the WIP section of you tutorial?

    Quote from: Unit_33 on July 14, 2012, 03:14:12 PM
    Ok... but what about pieces of msh which don't seem to have a single chunk?
    ...
    Does this fall under the WIP section of you tutorial?

    Yes.

    /begin wall of text
    Isolating them is quite a bit more involved.

    You can see me struggling to find words for the process in an earlier post.
    The basic idea is to load the actual data for the chunk into a spreadsheet and use patterns in that data to illuminate pieces.

    The data I trace is the UV's.

    When you look at the UV's for a msh, there are bits and pieces seemingly self contained.
    The WIP above finds all the vertecies associated with a set of selected UV's.
    Once found, the vericies are either isolated or removed and the SEGM for it is rebuilt via the autoit scripts provided in the kit.

    It's possible to even extract pieces within a discrete "UV piece" (again, no words) but it's better to stay with the piece as outlined by the UV's.

    I am not certain, but I believe what I am isolating are the individual smoothing groups.
    The vertecies along the edge of the "UV pieces" are typically duplicated, having identical coordinates, but different UV's and different normals.

    I had hoped to automate the process of tracing the edges, and I suppose I still could.
    Eventually, I will have to identify the smoothing groups and define them for my msh2milkshape converter.
    ....

    But yes, the stuff that isn't in a discrete SEGM or MODL is a bear to get to.

    July 14, 2012, 04:22:01 PM #13 Last Edit: July 14, 2012, 04:23:32 PM by Unit_33
    I suggest that if there is no applicable vocabulary you should make up some words ;)

    I shall endeavour to freshen up my spreadsheet skills to be able to proceed ...
    I usually only use them for mundane tax schlock.

    July 14, 2012, 05:16:46 PM #14 Last Edit: November 02, 2012, 07:39:04 PM by tirpider
    -edit.
    Before i can let you get excited about this.. I must let you down.

    Explaining this process is so much like explaining how to use a computer in general. I have a hard time staying on track and in the mean time, I'm not furthering the msh research itself. In short, this burnt me out and made me reconsider what I'm doing here.

    I've recenly made some interesting discoveries about how to manipulate the data that would be in this spreadsheet process, but it will require a signifigant change to the existing tools. I'm going to cancel the last 2 parts of this series, as I make those changes. The result will be a more self explanitory toolset that lends itself to a more productive model alteration process.

    The next few posts will explain how to get started, but it cuts off just before it gets real. If you are adventurous, PM me and we might be able to set up a chat somewhere (xfire perhaps?) where I'll walk through it and answer questions.  Once you have it down, it's about an hour process for a single segm. Walking through it will, of course take longer, so we would need to schedule a time.

    I appologize, but this is just a bit much for me and would rather be cutting the msh's up than trying to explain a novel process that's better done in a professional modeling program.

    end edit


    You know what?
    I'm just going to dive into this write up.

    Like the above walkthroughs, I will probably miss some things, but I have made plans and alternatplans, and talked about stuff for to long. I worry too much about getting it 100% right the first time, and all that does is keep it from happening.
    We learn from our mistakes, yes?

    If I miss anything, I expect that those who want to pursue the method will ask for clafification or further instructions.



    WIP


    EXAMPLE 4 - Piece Extraction
    Removing the earpiece from all_inf_snowtrooper.msh


    INTRODUCTION
    [spoiler]Earlier I demonstrated how to use my MSH2Chunks and Chunks2MSH tools to remove and add MODL pieces to SWBF MSH files. It's very simular to the way msh's have been hex-edited before, only with some extra tools to eliminate a lot of smaller edits that could lead to hard to troubleshoot errors.

    Now, I am going to go further and show how to get at pieces that aren't in thier own discrete MODL chunk.

    This can be used to:
    1- remove unwanted geometry from a msh.
    2- extract obscure pieces to use in other kitbashing projects or to be made into addon msh's.
    3- well.. I don't have one for 3. After seeing the way it exposes the data, I expect than many of you will have some brilliant uses for it.

    The usual warnings apply here. It's a time consuming task that being explained by someone that doesn't fully understand it and has a hard time explaining things :) .  I recommend patience and lots of questions.

    I hope to make these examples obsolete someday by working the steps into an automated process. But I work very slowly at times, and it may turn into several months (or years, if ever) before I can make that happen.  For now, I see no reason not to share, even if it's an overly complex process, it is something that exists where others have said it wasn't possible.

    In this example, we will remove the earpiece from all_inf_snowtrooper. There are more exciting things to edit, but this will get the ball rolling.

    The basic layout of this walkthrough is here:
    [spoiler]

    • INTRODUCTION - describe the overall goal of the walkthrough, and identify how this can be usefull to modding other projects

    • PRE-REQUISITES - go over the tools and knowledge needed to acomplish the goals laid out in the introduction


    • INITIAL SETUP - gather resources and assets together

    • ENVIRONMENT SETUP - get folders and tools ready

    • MODEL SETUP - prep the model so that it will work with our build tools and visualization aids


    • PREPARE REIGON MAP - create the uv maps, load them into Paint.net along with the texture

    • DEFINE REGIONS - mark off discrete, continuous areas in a new layer of the region map. mark off the specific area of interest if needed.


    • LOAD THE SPREADSHEET - [not done]use the info tool to copy information into the spreadsheet. Also copy coordinates for regions to the spreadsheet.


    • PREPARE AND TEST THE CUTTING SCRIPTS - [not done]copy the code from the spreadsheet to the DATA.au3 script. Check that _ChunkBuilder.au3 is set up. preform a test build and test the msh.

    • SET THE CUT DATA - [not done](no words for this. It's an array of copy paste movements in the spreadsheet)(this one should be an adventure)

    • PREFORM EDIT - [not done]Load the cutting script, run, build, and test.

    • ... should be done at this point - [not done]rename files and done.

    • ROOM FOR IMPROVEMENT - [not done]suggestions on what else to do to improve edits like this.

    [/spoiler]
    It will develop as this thread does[/spoiler]


    PRE-REQUISITES
    [spoiler]This example uses several tools. I'll list every application I used here and very briefly go over how it is usefull or what you need to know about it to be able to get through this successfully.
    It's worth mentioning, that all this is in a Windows environment. I'm doing this on XP, to be specific. I don't believe that AutoIT runs on a Mac, and I know my tools won't. I appologise to the Mac community for this.

    Tool descriptions are under here:[spoiler]

    • My custom tools (download link)
      Descriptions here:[spoiler]
      _ChunkBuilder.au3 - This is an autoit script file that is used to rebuild the POSL, UV0L, NDXL, NDXT, WGHT, and STRP files from the data provided by _DATA.au3.
      .au3 files can be opened in a text editor, but I don't suggest changing anything in it till you become familier with both, this process, and autoit in general.

      _DATA.au3 - this file is called by _ChunkBuilder.au3. It is where we will be pasting data from the spreadsheet.

      _Part.ods - This is an OpenOffice Calc spreadsheet. This guy is the workhourse of this process. We will paste data into it, copy data out of it, and move data around within it. I was doing all this stuff via notepad till I realized computers were suposed to crunch numbers for humans and not the other way around.

      BuildIt.bat - This is a convienience batch file that calls the chunks2msh program. Once you are comfortable with the build process, it can be customized to your needs.

      chunk2MSH.exe - This program simply concatenates the various chunk files to make a new msh. There are dos commands to do this, but this program is specificly designed to look in the folders created by MSH2Chunks and the DOS command adds carriage ruturns to the things it concatenates.

      ModelMunge.exe - This is a pandemic tool. I call it from buildit.bat to give a quick look at how the new msh will be treated by the munge process. The only thing I changed in the calling line is the locations and added the verbose option.

      MSH2chunks.exe - This program will cut a msh up into pieces defined by the tag structure of the msh and save them in an array of folders for convienient access.

      strp2ndxlt.exe - this guy can be used to rebuild NDXL and NDXT tags to increase the compatability of the msh with certain programs (like 3D Object Converter)

      SWBF_MSH_INFO.exe - This loads a msh and displays it's information in a somewhat translated format.
      I have put some copy functions in it to make copying and formating msh data easier.

      TagSizeValidator.exe - loads a specified msh file and searches for size fields. then it checks to see if those fields are correct. then it corrects them, saving a report afterwards.

      testMunge.bat - this was a backwards attempt on my part to speed up testing the msh. It should never have been included and is to be ignored.

      The x64 folder contains executables that I authored and compiled with the 64 bit option. If one of the tools gives you problems on your 64 bit machine, copy the executable from here in it's place to see if that fixes the issue. I don't have a 64 bit machine, so the only validation I have that any of these work is from those of you that have tried them out :)
      [/spoiler]

    • OpenOffice.org Calc (website link)
      OpenOffice.org is a free suite of applications (Word Processor, Spreadsheet, Database, ect..) Calc is the spreadsheet application for OpenOffice.
      I have set up a spreadsheet with formulas to help wrangle the MSH data. The things you will need to know for the sake of this walkthrough are : how to select cells, how to copy and paste, and how to drag cells so that they expand as a series. I'll touch on how to do this in the steps, but it would help to already know.

    • Paint.net (website link)
      This is a very capable image editing program (also free), simular to Gimp. I chose it because I don't like Gimp's interface or name.
      It is used to find the numbers we need to isolate UV groups. We will use layers, draw lines and make heavy use of the coordinate indicator box on it's status bar. All we will actually take away from it is the coordinates, so there is no need for fancy plugins or artistic skill. Just lines and numbers.

    • XVI32 (website link)
      XVI32 is a basic hex editor. It shows us hex and gives us a way to put data in the chunk and msh files directly.
      It will be used in the same way as the previous examples. We will make small adjustments to indexes, and possibly rename strings.

    • AutoIT (website link)
      This is a (free) scripting language. It is sort of a cross between BASIC and the MS Batch files. It's primary use is for automating windows managment tasks, but is quite capable as a general programming language with many user made extensions and an active development community.
      In this walkthrough, the tools that rebuild the SEGM information is based on un-compiled Autoit scripts. It needs to be installed so that those scripts can run. If this one isn't installed, then this walkthrough wont work.

    • IrfanView (website link)
      This is an image viewer with light editing abilities. (It's one of my favorite programs)
      All this will be used for is to resize and verticly flip images. If you have another program for it, then you can use that.

    • Notepad
      Basic text editor.
      While developing all this, I remember spending a lot of time  bouncing text in and out of a text editor to strip formatting before pasting into the spreadsheet. It may turn out that we don't need this (I'll remove it if so) But make sure you know where to find it just in case.

    • 3D Object Converter (website link)
      A shareware 3d model viewer/converter. It's really quite capable. I haven't needed to use it to actually convert models, but I like it as a msh viewer.
      We will use it to view msh files, generate UV bitmaps, and possibly to identify named MODL chunks.

    • Tim Skillman's MSH Viewer (download link)
      This is the standard msh viewer for SWBF msh files. I has some quirks, but it's quick and displays the msh.
      We will use it to test/view the generated msh file(s) to find geometry and test for msh functionality.

    [/spoiler]

    Some of the above may be replaced with equivalent programs, but Calc and AutoIT are firm. The process relies on some of the quirks of those programs.

    If you need help with the above programs, ask and I may be able to help. (If I can't, I can help track down the help we both need ;) )[/spoiler]


    This section is complete.
    Next are various setup steps that assume you have the above pre-requisites installed and configured properly.