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 (http://www.swbfgamers.com/index.php?topic=4752.msg45669#msg45669): 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 (http://www.swbfgamers.com/index.php?topic=4752.msg45897#msg45897): Place the same backpack onto another unit.
This is my method for "hex editing" chunks onto other units.
- Make An Addon (http://www.swbfgamers.com/index.php?topic=4752.msg45948#msg45948): Make the above Backpack into it's own msh (for use as an addon msh)
Extraction (http://www.swbfgamers.com/index.php?topic=4752.msg46896#msg46896): [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 (http://www.swbfgamers.com/index.php?topic=4752.msg46896#msg46896) post.
end edit
EXAMPLE 1
remove the backpack from: BFBuilder\Assets\Sides\IMP\MSH\imp_inf_shocktrooper.mshWe 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 (http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm)
We'll actually be spending very little time in the hex editor.
- Image Editor : Paint.NET (http://www.getpaint.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 (http://www.openoffice.org/)
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 (http://www.swbfgamers.com/index.php?action=downloads;sa=view;down=452)
For testing the finished product.
- Tim Skillman's MSH Viewer : SWBF MSH Viewer (http://www.swbfgamers.com/index.php?action=downloads;sa=view;down=324)
For visualising all the msh data.
- my msh toolkit : pre-alpha_msh_kit.zip (http://dl.dropbox.com/u/58361588/MSH_Kit/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 (http://www.autoitscript.com/site/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 (http://www.swbfgamers.com/index.php?topic=3905.0)
[pic]Standard Unit 'Skeleton' Chains (http://www.swbfgamers.com/index.php?topic=4595.0)
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)
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FInfo_01.png&hash=cc18bf3a17ae6e25012d241ace10f56d36bc193b)
- 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.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FProjectFolder_01.png&hash=664193f519448df018fd7024675474b5c25466c2)
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FProjectFolder_02.png&hash=2d7567132f2eae7b9174992e5a19f20de0b6944a)
[/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.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FMSH2chunks.png&hash=f00be77cefbda733c1aebf9e6bf861ddbc14fae4)
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
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FMove_tool.png&hash=bba05c58a625fd3d5b9982d2233c58be3e045419)
- 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)
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FAfterRunningBuildIT.png&hash=f0036dec3d7ee79eae7c96ec0c10436dc62db738)
[/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 viewerLoading 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 itThis 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.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FBeforeAfter.png&hash=80cae747d66596ae6b27b1e80d0017e1a37a8d81)
Example Files (5 mb rar) (http://dl.dropbox.com/u/58361588/MSH_Kit/MSH_KIT_EXAMPLE1.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: = :(
EXAMPLE 2Place a backpack onto rep_inf_ep3trooperSame 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:
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX2_01.png&hash=8d119cc6c3652bd4d7b07564d01487dae4248f1f)
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX2_02.png&hash=81d7c4fd8f5a0581f6091be0df02248032083c89)
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX2_03.png&hash=90bab4c37f7ea587933dd05679aeec98eda05ecb)
- 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)
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX2_04.png&hash=6c541ede3473959fcbf1536194cd1e877e4150d2)
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:
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX2_05.png&hash=e3222e11c64235093498205878a38c4b7b5c6de7)
[/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:
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX2_06.png&hash=8a07d22566a31a6c2ee7b86dcc064e768875ad55)
[/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.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX2_07.png&hash=940d2439b5903eaed1607cbe820d5fd2a0bd07cd)
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
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX2_08.png&hash=7eb96f180bea5ab2e7b4b9ae79390e97a88f24de)
- 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
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX2_09.png&hash=cbfc5bc7c95f96de6c0e06282c6fb8b9e10de89a)
- 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)
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX2_10.png&hash=2509ec9a81a8f4987b26face57f442ff30880dc9)
- 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.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX2_11.png&hash=899028222b17b3db56a316f0248519c40e778a9b)
Example Files (5 mb rar) (http://dl.dropbox.com/u/58361588/MSH_Kit/MSH_KIT_EXAMPLE2.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)
EXAMPLE 3Make An AddonSpecificly, 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:
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_01.png&hash=fc6f589268de7bb48ebbad6e0b17701cf0653d8c)
[/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"
- (https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_02.png&hash=177959f8b5c71a2669faa3833ba4e281e64186e4)
- 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:
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_03.png&hash=d3c05b55b62cf58689f28f3ca5c4a6479767700b)
- 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
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_04.png&hash=c186a9848e577866ade7c8f449434969244cc713)
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.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_05.png&hash=713a8ece843f6b7c6c5b188e28eb2b8b1a6d0b0e)
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_06.png&hash=b0a428f491aa32d442064b2dda983b8c8c412b47)
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).
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_07.png&hash=e1f93c33b1cb3c10ecb25ecc660499edbf946852)
- 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.)
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_08.png&hash=4d6c12902f71e7569a508bb5418b4d373c0484b9)
- 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).
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_09.png&hash=e393cdd158497099970d679e7d897cf567a26e26)
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.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_10.png&hash=d5994a01c1f0df311e5a1f66e04341084efd63fb)
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_11.png&hash=7da8348842860aa13cad90cbbb9561313b67f5bd)
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.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_12.png&hash=e9f66870cb2b75c4031da109e2cb3f5192c53a7c)
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.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_13.png&hash=5deaa72508cf693085e8808f52c7e7515ed1bb18)
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.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_14.png&hash=7c4aae5ce06dba889fd703fe2c5c1b4cab72ad1a)
- 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:
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_15.png&hash=b9df0aeab8228412a8110656534c015a8164bc25)
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.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX3_16.png&hash=88129571063c788726ffa6e30654fcfa9180754b)
A half finished Tusken Raider taking his new Shocktrooper Backpack out for a picnic.
Example Files (5 mb rar) (http://dl.dropbox.com/u/58361588/MSH_Kit/MSH_KIT_EXAMPLE3.rar)
Next:
Isolate a part of a mesh thats embedded in another
-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]
WIPman...
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.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FCandidate_401.png&hash=4b08dd74780bd69dbab09241935a78f966212fb8)
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FCandidate_402.png&hash=93aa27d18b6c3b4c4500c59416980ccf9ab8d074)
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.
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 (http://web.t-online.hu/karpo/))
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](https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2F3doc_2.png&hash=7320a27f989be2865610f513b06a088fd23d63e4)[/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.
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.
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.
-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 ExtractionRemoving 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 (http://dl.dropbox.com/u/58361588/MSH_Kit/pre-alpha_msh_kit.zip))
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 (http://www.openoffice.org/))
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 (http://www.getpaint.net/))
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 (http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm))
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 (http://www.autoitscript.com/site/autoit/))
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 (http://www.irfanview.com/))
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 (http://web.t-online.hu/karpo/))
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 (http://www.swbfgamers.com/index.php?action=downloads;sa=view;down=324))
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.
When this epic tutorial series thread is complete I'd like to convert it to PDF format if thats okay with you. Amazing work here, hopefully I get some time to study it some more soon. Great job.
Quote from: Phobos on July 15, 2012, 02:24:57 AMWhen this epic tutorial series thread is complete I'd like to convert it to PDF format if thats okay with you.
That's fine. I'd like to go back over it all with a spellcheck at some point.
It seems epic, but I hope that is because I am over explaining things.
WIP
EXAMPLE 4 - Piece Extraction
Preperations
INITIAL SETUP
[spoiler]As before, we need to have a project folder.
In that folder we need a place to keep the source materials and a place to work on the msh.
The folder hierarchy here isn't explicitly important, but it makes keeping track of a project easier.
Here is a screenshot of my initial project folder:
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_01.png&hash=1bdc89d8a3a3a3c6d78e7c17f66cc071d567a8ec)
_tool is the folder from the msh kit archive. It needs to keep it's folder name.
sources is for source material, and is empty at the moment.
Now we need to gather the assets of the msh we are going to edit.
I chose to remove the earpiece from the rebel hoth soldier for this example.
While this is not the most useful thing to do, it is an easier one to explain.
So, make a folder in sources to recieve the assets and copy them from the bfbuilder assets folder.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_02.png&hash=23149963d0c9ae27fe707d704cf47cb1b5d763ae)
Just the stuff for the snowtrooper, his lowres would be in it's own project folder if we were going to go that far with this.
Time to move on to tearing the msh down and creating a build environment.[/spoiler]
ENVIRONMENT SETUP
[spoiler]Run MSH2chunks.exe in the _tool folder and direct it to the all_inf_snowtrooper.msh in the sources folder.
Press ok and it will cut the msh up for us, leaving a _chunks folder in the same folder as the msh.
Now move that _chunks folder to the root of our project folder.
Then move the _tool folder inside the _chunks folder.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_03.png&hash=2cfe81d5186f7f134be1bdce305d7b054925e91c)
Copy the BuildIt.bat file to the root of the chunks folder.
Run it once. (It will ask you to press a key when it is done)
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_05.png&hash=8cf9cb1a7d775f0eb14ca88ae47a82190b13ae87)
There should be some new files in the _chunk folder now.
_recycle - think of this as a temp folder. Chunks2MSH ignores this folder and it's contents when rebuilding the msh.
modelmunge.log - the log file produced by ModelMunge.exe. ModelMunge isn't required for all this, but it is sometimes convienient to have this for troubleshooting wierd issues. (wierd is common with this process)
tst_inf_tst.msh - this is the rebuilt msh file.
tst_inf_tst.msh_Report.txt - a report of all the changes made by the size validation tool. Sometimes it's useful, most of the time I never even look at it.
Copy the tga files for the msh, from the sources folder to the _chunks folder.
This is so that the model will be textured when testing in the viewer.
It can be easier to spot things with the tga's in place.
Now, open the msh with the MSH viewer.
It should look the same as the original msh.
Ok, thats the build environment.
We have the msh torn down, and can rebuild it.
Any changes you make to the chunk files in the folders will be reflected in the rebuilt msh after buildit.bat is run.
Next we make sure that the model is ready for this specific edit.[/spoiler]
MODEL SETUP
[spoiler]Sometimes a msh needs to be adjusted a bit to work with all the tools.
The most common I have run into involve getting the msh to load in 3D Object Converter correctly.
I use the Unwrap feature in 3DOC to produce bitmaps of the uv's later.
This process completely doesn't work without those bitmaps, so getting the msh into 3DOC is critical.
Sometimes there is an error in the msh data that prevents it from loading into 3DOC. The next step can help identify what MODL chunk contains the error. The errors range from a trailing null in the STRP, to an absent NDXL chunk. Fixing those errors is another topic that uses the same tools and techniques in these examples. Right now, I'll demonstrate a solid workaround that helps identify them though.
Side Note:[spoiler]( The errors usually don't prevent the model from munging properly. This just proves that different programmers have different ways of loading assets. It turns out that 3DOC relies on a part of the msh that was only used to build the ps2 version (NDXL) to generate polygons. ModelMunge for pc uses the STRP only and completely ignores the NDXL and NDXT. But if we want the msh to work with 3DOC, we need to have a working NDXL.)[/spoiler]
Without going into messy repair details, the most common offender is the shadow volume (the chunk whose name starts with sv_ )
We just pull it out while working on the msh, then put it back in after our final build.
Another reason to temporarily remove the sv_ it to help in visualizing the msh.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_06.png&hash=7e3647820d8ecfd98339f409ee7ecec8e6e26079)
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_07.png&hash=553659fefa9dc4a33b05f7663ddc4bdff95f655e)
The grey stuff poking out of the model is the shadow.
You can see how much cleaner the second one is, without it.
To remove it, just move the sv_ chunk folder to _recycle.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_08.png&hash=289e15c213aaa938e5340ed79578113ac1cdf7dd)
BuildIt.bat and chunks2msh will ignore all the stuff in _recycle when rebuildng the msh.
To put it back in, just move it back to the _chunk folder and run buildit.bat.
-
The model we are using doesn't have any problems loading in 3DOC, but it still helps to get the sv_ out of sight for visualization purposes.
<this space reserved for further repair explination or a link>
If you have a project that throws errors, or won't load at all, and I haven't got a topic started on how to fix those, then pm or ask and I'll try to help out.
It may help to know that passing a troublesome SEGM through this process fixes some (not all) of the errors.[/spoiler]
Setup is done.
Next we will get the uv map and use Paint.Net to define (discover?) the UV regions (smoothing groups?) of the msh.
WIP
EXAMPLE 4 - Piece Extraction
Define UV Regions
PREPARE REIGON MAP
[spoiler]UV's are the coordinates on a texture that a vertex is mapped to. If you connect all the coordinates together in the same way the vertecies are connected, you get a UV "map'.
You will notice on most textures ( not just SWBF msh's,) the connected UV's tend to form islands or groups when layed out. Those are what I am calling "UV Regions.
There may be a proper term for them, but that is the term I am sticking to for these examples.
What we are about to do is create a Paint.Net file (pdn) with layers for the UV's, texture and a working layer for marking regions. All this could be done in Gimp, Photoshop, or any image editor that handles layers. I am going to use Pain.Net because it is free and accesable to me. (Gimp confuses me and photoshop is out of my price range.)
For future reference, it is most helpfull to only use one tga per pdn. Basicly, work with one MODL or SEGM at a time, to keep things from getting confusing.
Also, I try to keep track of the pdn files, in case I need the numbers from it again.
Onward..
Getting the UV map is easy.
Load the tst_inf_tst.msh into 3D Object Converter. (Shareware or registered, it doesn't matter)
Press the Unwrap UV button to bring up the Unwrap paramaters dialog.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_09.png&hash=746c1d82fbaa3dcc6faa8020e6c3f2cbd1344d51)
Make sure the output resolution is set to 1024 x 1024.
Select the object name of the piece we are working with (in this case, it is override_texture)
Then check the Save the selected objects' UV map checkbox and press ok.
Before closing 3D Object converter, this is a great time to find the name of the MODL that contains the earpiece.
Press the Object and Material Selector button to open the Object and Material Selector.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_23.png&hash=9f89d26a5404e7cf5f5e090b9e941df8c55ab458)
Clicking on each of the items under 3D Scene will highlight the piece associated with it in red.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_24.png&hash=6125e51ec8d716517759f98109a355651bebf5ab)
You can see that override_texture is the one that contains the earpiece. (and a LOT of other things as well)
That is the name of the MODL chunk we will be working with.
Close 3DOC.
Copy all_inf_soldier_hoth.tga and tst_inf_tst.msh_override_texture.bmp to _recycle.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_10.png&hash=b72754bc259ffc4064faacb4f1edb0653a804ad7)
The tga will probably still have the read only attribute set on it if you got it from the bfbuilder assets.
Right click on it and select properties.
Then uncheck the read only box and press ok.
Next we prep the files to be imported into Paint.net
They need to both be 1024x1024 and flipped verticaly.
I'm sure there is a way to do this inside the program, but this is how I do it.
Open the tga in IrfanView and press ctrl r to bring up the Resize dialog.
Change it's width and height to 1024 and press ok.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_11.png&hash=e107a0fd728c555c5cce97f66afe0b213ddc9115)
Press v once, to flip it.
Press ctrl s to save it (make sure it is being saved in the _recycle folder and not the _chunks folder.)
Confirm it's overwrite request.
Next, open the bmp with irfanview.
Press v to flip it, and ctrl s to save.
Close IrfanView.
The files are prepped.
The size is for compatability with my spreadsheet. 1024 gives a prety detailed resolution for trapping uv points.
We flipped it because of the way Paint.Net indexes coordinates. We need the 0,0 to be in the same corner the game sees it. It's easier to flip the textures than to code around it in the spreadsheet.
Next, we import them into Paint.net
Open Paint.net
We will need 3 of it's utility windows open.
Tools, Layers, and Colors.
They can be toggled on and off with the function keys F5, F7, and F8, or can be selected on the Window menu.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_12.png&hash=13a98fd553e57c8c9c83adec7ef475eda2ea0f0c)
Select "Import From File" on the Layers menu.
Then browse to the _recycle folder where the 2 images we preped are located, and open the all_inf_soldier_hoth.tga.
This imports the image as a new layer.
Do it again but this time, open the _override_texture.bmp.
There should be 3 layers in the program now.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_13.png&hash=cae96648ea8ce1008c1b8845b973e87302cf5555)
Click once on the "Background" layer and press the Duplicate Layer button on the bottom of the Layer window.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_14.png&hash=8ffffdca9521a83a975236527a9bcc60913a89f4)
Now we are going to rename some stuff so you know what layer I am talking about later.
Double Click on one of the layers named Background and rename it to "Regions".
Rename the layer with all the UV lines to "UV"
Rename the layer with all the tga texture image to "Texture"
Now, use the arrow buttons to reorder the layers.
From top to bottom, they should be, Regions, UV, Background, Texture.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_15.png&hash=5f7ce1c4ebf2a91d201e7e7382467e0357d95b41)
Now to prepare the layers.
Regions need to be empty, so:
Click once on the Regions layer to select it.
Press ctrl a to select everything on the layer.
Press delete once on your keyboard.
The white space in UV needs to go away.
Click once on the UV layer to select it.
Click on the "Magic Wand" tool on the toolbar.
Ensure that flood mode is set to global.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_16.png&hash=c8ec0c8c0fd048f1071bc48b37ca5de7f6c4abfe)
Click once on any white space to select everything but the black lines.
Press delete once on your keyboard.
Uncheck the box next to the Background layer to hide it. You should see the lines on top of the texture.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_17.png&hash=a44f051be53102d46f01eeda2d363c81e4aa5106)
If not, then you need to re-do the layer preperation.
(ctrl z (Undo) is your friend)
Save the file.
Make sure you save as a pdn file so the layers stay intact.
I like to name it after the tga texture that I'm working on, so call it
"all_inf_soldier_hoth.pdn"[/spoiler]
DEFINE REGIONS
[spoiler]You see all the islands of uv's? Those are what I was talking about earlier.
We are going to be surrounding most all of them with a basic box.
Later on, during the data collection part, we will be getting the corner information from each of those boxes and recording them in the spreadsheet.
What's happening with the black lines is that each UV reference in the msh refers to a point somewhere on this texture. When you connect them in the order the msh connects them (via triangle or polygon definitions found in the NDXL, NDXT, and STRP chunks) you end up with the lines seen here. The boxes we are about to draw are 'traps' that define a region that contains the UV points we want, and through that, we identify the vertecies we want in the spreadsheet.
The reason I say we will surround most with boxes is that we don't want any to intersect at all.
Some of the shapes (the torso and arm part, for example) defy being surrounded by a single rectangle without intersecting another box. The solution for that is to use several boxes to surround pieces of it. or be very clever with "acceptable intersects".
I won't cover that method here, as we aren't chasing a torso, and I want to keep it as straight forward as possible.
We don't actually need to surround each and every one, but it can help troubleshoot issues later on if we do.
To get started, we need to have the Background layer (the solid white one) enabled, so check it's box in the layer window.
This makes it easier to identify 'island' seperations.
Click once on the 'Regions' layer and close the layers window.
When you have a layer selected, all edits only happen to that layer. We close it to prevent accidentally switching layers and to get the window out of the way.
Now, left click once on red on the color window and close it.
Red will stand out nicely against the white background. You can use any color, I choose red. And, again, we close it to prevent accidentally switching colors and to get the window out of the way.
Left click on the line tool
Adjust the line width to 1
Turn off Antialiasing
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_18.png&hash=c55ec6d134a250d892ab36f0010672ab1b1f157c)
Next, click the grid enable button.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_19.png&hash=08923829911ab2e0618a49ca592dea18d4777851)
This will give us a grid when zoomed in. It makes it easier to keep the lines straight.
We will begin with the piece in the upper left corner.
Don't worry so much about identifying pieces yet. Right now we are just getting the bits isolated.
Zoom in on the upper left corner till the grid spaces become nice and big.
If you are using a scroll mouse, holding ctrl while you scroll the wheel will zoom in and out.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_20.png&hash=de6aeeacbb2ffd7ab8c0cf36f65c28ab678edcfb)
Start laying down an outline around the shape, with a 1 pixel gap between your lines and the shape.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_21.png&hash=366037bb7e4236528d4eccff04af50befd921b4a)
Work in small sections and surround the entire shape.
The 1 pixel gap is to accomodate rounding errors that might appear in the spreadsheet.
The outline has to be a rectangle. No bumps at all. So if you encounter a bit that falls out side the outline you are drawing, you have to erase that line all the way back to it's starting corner and start over to accomodate the bump in the uv island.
In instances where you cannot include a 1 pixel gap (like the edge of the image) it is ok to go ahead and draw the line on the edge. This is an area that I haven't encountered much, but it does come up. If it introduces an error, then we will have to cover it then.
Repeat this for all the pieces that can be outlined without intersecting other outlines.
Here's what I ended up with:
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_22.png&hash=954b75381d888c192209ba7fab08c3d4af749516)
Save and exit Paint.net
Here is a cheat. At the end of this post is the a zip containing the above pdn.
You can use it for the rest of the walkthrough or as a reference to what needs to be outlined and how.
I encourage you to try to outline it yourself to become familiar with Paint.NET's controls.
all_inf_soldier_hoth_pdn.zip (http://dl.dropbox.com/u/58361588/MSH_Kit/all_inf_soldier_hoth_pdn.zip) (2.6mb zip)[/spoiler]
That's it for defining the regions.
Next we will load the spreadsheet.
WIP
EXAMPLE 4 - Piece Extraction
Gathering data and loading the spreadsheet
LOAD THE SPREADSHEET
In the _tool folder there is a file named part.ods. That is the spreadsheet that will hold all the data from the SEGM and produce the code needed to let the AutoIT scripts rebuild the piece.
I should probably mention this earlier, but here is a good place to state that you can only work with one SEGM at a time. What that means is that the spreadsheet and scripts are only set up to work with one set of SEGM data. This isn't really relevent to this example, but as you pursue other edits, you will see what I mean. I may make an additional example that shows how to split the folder of a MODL that has more than one SEGM chunk.
Back to the project.
Copy the part.ods to the folder of the MODL chunk we are working on.
(the 110_GEO_2_override_texture folder.)
Open the part.ods in the 110_GEO_2_override_texture folder.
(It takes a bit to load. I didn't include macros or anything like that, just cell formulas.)
Now go back to the _tool folder and run SWBF_MSH_INFO.exe (if you are on a 64-bit system, you will need to run the SWBF_MSH_INFO.exe in the x64 folder)
Select File>Open and browse to tst_inf_tst.msh (it should be one folder up)
Once it it opened, browse to the override_texture MODL chunk on the left part of the program.
Expand it out to see all the pieces under it.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_25.png&hash=36b635de53c299b69809d947df4f555374fc9e26)
Click once on SEGM in the tree view on the left.
Select Tool>Copy selected SEGM vertex Summery
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_26.png&hash=0dbd9f6c21162a08b62e56fc1aaf4c88dcfd6e53)
That copied all the POSL, WGHT, NRML, and UV0L data onto the windows clipboard.
No go back to the spreadsheet. (leave the MSH_INFO_tool open, we need a few more things from it.)
Make sure the vPaste page is selected
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_27.png&hash=498794fece949babbc131899a6e8efcf0ae12ff7)
and select the first cell under idx.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_28.png&hash=0c0ee8797d543262f45627d3633d6d2f005f1d5a)
Press ctrl v to paste the vertex data.
Calc will prompt you for formatting instructions.
The only thing you should have to adjust is to make sure Tab is checked.
Press ok to finish importing.
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_29.png&hash=a87810238ac680b0f4a4435599d791948e1da7ac)
The sheet should fill with numbers
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdl.dropbox.com%2Fu%2F58361588%2FMSH_Kit%2FEX4_30.png&hash=739852ad4527aafa729239c16450383881d66807)
If it doesn't, then go back to the info tool and select the copy tool and try again.
The Info tool has not been tested a lot, so it is possible for it to do unexpected things.
PM/email me or post if it gives you grief, and I will try to fix what I can.
We need to extend the formulas for the vertex count in 2 other sheets.
To do this, we need to copy the vertex index column.
Select the filled cells in the idx column on the vPaste sheet.
I do this by selecting the idx cell, then press ctrl shift down
Press ctrl c to copy it to the clipboard
<screenshot>
Click on the vBuilder tab to open that sheet.
Select the idx cell and press ctrl v to paste the column of vertex indecies
<screenshot>
Now, click the General tab to open that sheet.
Again, select the idx cell and press ctrl v to paste the column of vertex indecies
<screenshot>
<break>
(I realized how rediculous daily edits to something this big is. So I am writing the rest offline and will update when it's done. )
Sorry for the necro-post, and the double post... and all the other "I'm sorry's".. heh
I have to cancel the last two parts of this series. I've indicated this in the first post (http://www.swbfgamers.com/index.php?topic=4752.0) of the thread and at the begining of the fourth part (http://www.swbfgamers.com/index.php?topic=4752.msg46896#msg46896).
It's a time intense process, that was eating at the time I could dedicate to actual projects. I (like most of the folks here) can't advocate dedicating youself to a hobby task that isn't fun.
I will gladly answer direct questions about any of all this. And if you would like to try walking through the last portions via chat or other correspodence, message me and we can arrange a time. Might take anywhere from a couple of hours to many hours. It's an involved process and it might just be easier to learn the XSI Mod Tool interface and ZETools.
I'm sorry for dropping this guide. I really want to share the process, but it's become a real drain on me. Actually making things that are going into the game is much more rewarding.
btw, I'm just dropping this project, not anything else.
Well, it's been a really useful tutorial, though some of it has been beyond my current comprehension I have still learnt a lot about .msh crafting.
Thanks tirpider!