SWBFGamers

Modding for the Original SWBF1 and SWBF2 => SWBF1 Modding Tutorials => Topic started by: tirpider on June 18, 2012, 07:22:32 PM

Title: How to isolate pieces of a msh p1 Piece Removal
Post by: tirpider on June 18, 2012, 07:22:32 PM
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.


-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.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:

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


References:[spoiler][/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.[/spoiler]


Workspace Setup:[spoiler](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][/spoiler]


MSH Modification:[spoiler][/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.
(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.
Title: Re: [WIP]How to isolate pieces of a msh
Post by: Phobos on June 18, 2012, 07:24:41 PM
Get well soon. I look forward to this very much.

:sick: =  :(
Title: How to isolate pieces of a msh p2 Adding A Piece
Post by: tirpider on June 23, 2012, 08:24:41 AM
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:

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][/spoiler]


MSH Teardown:[spoiler][/spoiler]


MSH Modification:[spoiler]
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)

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.

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.
[/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)
Title: How to isolate pieces of a msh p3 Make An Addon
Post by: tirpider on June 24, 2012, 01:32:34 PM
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:

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.

[/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.

[/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.
[/spoiler]


ODF Setup:[spoiler][/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
Title: Re: How to isolate pieces of a msh p4 Piece Extraction
Post by: tirpider on July 10, 2012, 08:52:53 PM
-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.

(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:

[/spoiler]
Title: Re: How to isolate pieces of a msh p1 Piece Removal
Post by: 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.
Title: Re: How to isolate pieces of a msh p1 Piece Removal
Post by: tirpider on July 13, 2012, 02:43:35 PM
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.
Title: Re: How to isolate pieces of a msh p1 Piece Removal
Post by: Unit 33 on July 14, 2012, 03:55:16 AM
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.
Title: Re: How to isolate pieces of a msh p1 Piece Removal
Post by: tirpider on July 14, 2012, 11:19:36 AM
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.

Title: Re: How to isolate pieces of a msh p1 Piece Removal
Post by: Unit 33 on July 14, 2012, 12:15:55 PM
Aha! Now that works like a dream. I have now edited a model. Oh joy!

Thanks!
Title: Re: How to isolate pieces of a msh p1 Piece Removal
Post by: tirpider on July 14, 2012, 12:23:32 PM
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.
Title: Re: How to isolate pieces of a msh p1 Piece Removal
Post by: 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?
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?
Title: Re: How to isolate pieces of a msh p1 Piece Removal
Post by: tirpider on July 14, 2012, 04:03:06 PM
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.
Title: Re: How to isolate pieces of a msh p1 Piece Removal
Post by: Unit 33 on July 14, 2012, 04:22:01 PM
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.
Title: Re: How to isolate pieces of a msh p4 Piece Extraction
Post by: tirpider on July 14, 2012, 05:16:46 PM
-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]
[/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][/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.


Title: Re: How to isolate pieces of a msh p1 Piece Removal
Post by: Phobos on July 15, 2012, 02:24:57 AM
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.
Title: Re: How to isolate pieces of a msh p1 Piece Removal
Post by: tirpider on July 15, 2012, 11:28:23 AM
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.

Title: Re: How to isolate pieces of a msh p4 Piece Extraction
Post by: tirpider on July 15, 2012, 11:55:53 AM


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.


Title: Re: How to isolate pieces of a msh p4 Piece Extraction
Post by: tirpider on July 17, 2012, 12:03:21 AM


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.


Title: Re: How to isolate pieces of a msh p4 Piece Extraction
Post by: tirpider on July 22, 2012, 01:10:31 PM


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. )





Title: Re: Cancellation
Post by: tirpider on November 02, 2012, 08:01:49 PM
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.
Title: Re: How to isolate pieces of a msh p1 Piece Removal
Post by: Unit 33 on November 03, 2012, 01:24:35 AM
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!
EhPortal 1.34 © 2024, WebDev