PDA

View Full Version : Tutorial - How to Modify M2TW MESH



Andromachus Theodoulos
08-17-2007, 18:37
Converting MESHes for MilkShape

Tutorial on How to convert a M2TW mesh to ms3d and modifying it and exporting back to mesh for use in M2TW.

This is something that has taken me a lot to accomplish, simply because of time available, but I must say this is something I wanted to do this for the community simply because people like GrumpyOldMan and Knight Errant have spent so many of their personal hours away from their families unraveling the many files that contain the mysteries that make Medieval II Total War such an amazing and wonderful game. For my part, Medieval II Total War, or for that matter any Total War game that has been produced are the ONLY PC games I have played, because they fed my desire for an excellent PC strategy and tactics game.

I want to personally thank Knight Errant and GrumpyOldMan, for it was both of these people who introduced me to the world of 3D modeling in the game world and they took this little toddler beyond just editing text files to actually working with the three-dimensional graphics of the game. My hats off to you two. :bow:

Now down to business.

PREPARATIONS FOR MODEL MODIFICATION

Now if I went into minute detail on every facet of model modification for Medieval II Total War, this would be an immense tutorial. Thus I have decided to omit sections which are found in other tutorials on this forum (to relieve ourselves of redundancy) and to attempt in some manner to address the key issues at hand. Things such as unpacking the pak files under data and other such stuff should be done prior to attempting model modification; otherwise you will not be able to find anything to modify…:inquisitive:

Please do not overwrite any of your vanilla files. What I have done is made a copy of all textures and meshes under a separate directory I call “Model Modification”. Not only do I provide myself with a backup of all meshes, but also I provide myself with a safe work area to store my masterpieces and my mistakes. :grin:

NOTE: Your mesh files are located in:
…\Medieval Total War\Data\unit_models…
Become familiar with what kind of base models the units you want to modify use, this is how the file structure under unit model is setup.

We will be modifying the pike_militia_ug3_lodx mesh, which is located under ln_3qplate_halfplate. These series of meshes will be found under the following directory structure:

C:\...\Total War\Medieval II Total War MyMod\data\unit_models\_units\ln_3qplate_halfplate

MESH CONVERTER by GrumpyOldMan
You will want to convert your MESH to an ms3d file format by using GrumpyOldMan’s converter found here…
http://www.twcenter.net/forums/downloads.php?do=file&id=1276

I. CONVERT YOUR MESH
To begin, open the converter

Select “Convert” found under the File pull down. (see image…)

https://img72.imageshack.us/img72/767/meshconverteropeningexpwa4.th.jpg (https://img72.imageshack.us/my.php?image=meshconverteropeningexpwa4.jpg)

*Note: the choices you have under the file Pull down:
Convert: this option allows you to convert MESH to MS3D and also MS3D to MESH (to load back into game)
Merge: This allows you to merge various M2TW converted MESH components or even other components from other models (like RTW converted CAS’s) into one model.
Quit: Make sure you use Quit, because hitting the “X” at the wrong time in the upper right hand corner can cause the exporter to crash unexpectedly.

https://img72.imageshack.us/img72/2300/meshconvertermodelselechm1.th.jpg (https://img72.imageshack.us/my.php?image=meshconvertermodelselechm1.jpg)
You want to convert MESH to MS3D

“LODS”
NOTE: Also something to think about is that all the work that we do here has to be done for all the lods of the various models in question. What I am doing here is using the lod2 because it has the smallest numbers of polygons which would work on most machines in terms of detailed graphics. The higher lods, lod0 and lod1have more detail in them. What I plan to do is modify only lod2 and then when the time comes, I will copy and rename them to all lods. This can also be done in the battle_model.modeldb, but I have not mastered the modification of this file as of yet, so I rather just "trick" the engine than actually modifying the lods in the battle_model.modeldb.

https://img146.imageshack.us/img146/2097/meshconverterwithpikemizq2.th.jpg (https://img146.imageshack.us/my.php?image=meshconverterwithpikemizq2.jpg)
This is how your model should appear in the MESH converter. By using the right and left arrow keys, you can spin the model around to get a full 360 degree viewing before converting.

II. BRING YOUR CONVERTED MESH INTO MILKSHAPE 3D
NOTE: On the use of and the tools of MilkShape 3D, please refer to Chumblasoft’s website for MilkShape 3D tutorials. (With this I am omitting some of the basic functions within MilkShape to avoid redundancy)
This information may be found here: http://chumbalum.swissquake.ch/

As you can see the MilkShape 3D interface is easy to use and here you can see the pike_militia ms3d ready for modification.

https://img146.imageshack.us/img146/9199/pikemilitiaug3lodinms3dqx9.th.jpg (https://img146.imageshack.us/my.php?image=pikemilitiaug3lodinms3dqx9.jpg)

Just for interest sake, I am going to also load the texture for this particular model. This can be found under the following directory:
C:\...\Total War\Medieval II Total War MyMod\data\unit_models\_units\ln_3qplate_halfplate\textures
https://img248.imageshack.us/img248/4879/pikemilitiaug3lodinms3dbw1.th.jpg (https://img248.imageshack.us/my.php?image=pikemilitiaug3lodinms3dbw1.jpg)
NOTE: Now, if you notice the model seems dark, which I myself am not sure why this is, some of our resident experts on this site maybe able to explain this. This is something that includes the more advanced graphics over earlier RTW models, and I have yet to learn what and how to make some of these more advanced graphics. Some of this has been tackled by our compatriots on the Org. Anyway, what I seek to do is move a vertex just slightly out of place which then lightens up the entire model. This is something you can do, BUT is NOT necessary.

Now let’s take a little break here and I will tell you what I am going to do. I am going to change this heavily armored pikeman into a fictional Neo-classical heavy phalangite. I am removing the vanilla sallets, pikes and swords and replacing them with a set of new pikes, new swords and new helmets.

To delete the pieces that I do not want for my new model, I go under the groups tab in MilkShape and select each individual piece and simply delete it:

https://img146.imageshack.us/img146/9985/pikemilitiaug3lodinms3ddg9.th.jpg (https://img146.imageshack.us/my.php?image=pikemilitiaug3lodinms3ddg9.jpg)

I delete all parts until I have the model shown above.
NOTE: Also notice some important subjects when dealing with 3D game models. First are your Materials.

Materials:
Materials are textures. These must be converted to dds format before bringing then into MilkShape. The texture to dds converter can be found on this forum here:

https://forums.totalwar.org/vb/showthread.php?t=75726

It is necessary to have the correct materials assigned to your new components. There are two basic sections for Materials in M2TW models; Figure and attachments. So that we can make maximum use of the textures we have available to us, I will load both. Later we shall see that is important to have Materials assigned to your new components you will want to bring in game.

NOTE: Now, in most cases if your are just making minor changes, most of the texture mapping for M2TW models is retained through the conversion process and when export (as we shall see later) is retained.

Joints
Joints are the Tab that handles your bones, vertices and weights which are terribly important to getting the model into the game. If your vertices are not assigned correctly, you could experience all sorts of mayhem and confusion when bringing your model back into the game. Disabilities such as Ray Man and Stiff Man Syndrome are common ailments to improperly assigned vertices in the model.

Ray man
{place holder for images …} Ray Man…

Stiff Man Syndrome
https://img144.imageshack.us/img144/7362/stiffasaboardod2.th.jpg (https://img144.imageshack.us/my.php?image=stiffasaboardod2.jpg)

NOTE: Please refer to the Appendices section of this tutorial for proper m2TW vertex assignments and weighting.

III. ADDING NEW ATTACHMENTS
We are now ready to bring in our new attachments. This are going to be the new helmets, swords and pikes that I have previously constructed. These can be new pieces that you have made yourself, brought in form other M2TW models or what is more exciting pieces from RTW. All the models you will see me attach to this pike_militia_ug3 model will be from these various sources. By having things setup this way, it allows to “kit-bash” models together for an endless selection and array of soldier types.

Let’s go through the steps to add our attachments.

First we need to prepare our new pieces that we will be merging into our model. This requires use to map the individual models with the correct textures and also assign the correct vertices to avoid some of the problems I have mentioned in the previous text.

https://img338.imageshack.us/img338/1867/swordsdy6.th.jpg (https://img338.imageshack.us/my.php?image=swordsdy6.jpg)
Here are the swords we will be using. I got these from various RTW mods and one is an M2TW model. All of these I cleaned up and heavily modified form my own needs. I must assign my swords with new textures otherwise they will look funny. In this case, so I have access to the plate metal in the Figure texture, I am assigning the swords to Figure in the Materials tab.

https://img236.imageshack.us/img236/9500/swordswithsometexturesmgm3.th.jpg (https://img236.imageshack.us/my.php?image=swordswithsometexturesmgm3.jpg)
Make sure your texture mapping is correct. To keep things simple, I am rescaling the mapping so that the swords are plain steel. I scale the swords mapping down in the Texture Coordinate Window of MilkShape 3D, which then allows my to put my sword over any texture I need to.

https://img338.imageshack.us/img338/5862/swordswithvertcicesassiiz4.th.jpg (https://img338.imageshack.us/my.php?image=swordswithvertcicesassiiz4.jpg)
As you can see here I have assigned the proper vertices to the swords. In order to do this, select the bone_weapon_weapon01 joint, then you need to select all the swords. Now in this case the scabbards are in the same group as the swords, so you will not be able to select their group. Once this is done, under the Joints tab select the button labeled Assign. That’s it. When and IF I cover the conversion of RTW models over to M2TW I will address the more difficult aspects of having to assign body vertices per joint bone on the skeleton body.

https://img117.imageshack.us/img117/1269/pikestexturedandassignewn6.th.jpg (https://img117.imageshack.us/my.php?image=pikestexturedandassignewn6.jpg)
These are the pikes we will be using. I actually hodge-podged these together from M2TW halberds and pikes. I have already mapped and assigned these as above.

https://img102.imageshack.us/img102/8866/helmetstexturedandassighk5.th.jpg (https://img102.imageshack.us/my.php?image=helmetstexturedandassighk5.jpg)
These are the helmets that we will be using. Now these are my pride and joy as these were the first helmets I made. The helmets are M2TW late body burgonets and the various crests are from modified helmets that were used in two very popular and well-done (I might add…) modifications of RTW. These various pieces of the helmets were assembled through GrumpyOldMan’s merge function in his mesh converter. I will show you further down how this can be done when we assemble the entire pikeman together. Also, all vertices are assigned to bone_head.

https://img102.imageshack.us/img102/8727/helmetsgroupingandrenamgp6.th.jpg (https://img102.imageshack.us/my.php?image=helmetsgroupingandrenamgp6.jpg)
This shows the vertex assignments to bone_head...

(NOTE: not bonehead, bone_head…:laugh4: )

A NOTE ON COMMENTS
This is a very important section which needs to be addressed.

You will for most of your components that you use to build your model, insert comments under their particular designation. Comments help the game engine place the various components of the figure together. This is needed because now with M2TW the engine is now able to put various parts of the model together to create random appearing units. It is necessary to have your Comments for each piece labeled correctly so that the game engine can place these correctly and maintain their position on the model throughout the lods as you zoom in an out. Otherwise, what happens is that as you zoom in and out, helmets will change or weapons will appear and disappear.

IV. MERGE FUNCTION IN THE MESH CONVERTER
My favorite function available in the converter is the ability to “kit-bash” various pieces of models together. This can be done under the merge function. Now, something to remember, that as your are assembling your pieces together, you must rename your ending model, because the converter is setup in such a way as to not allow you to overwrite one of your existing pieces your are using for assembly. What I like to do is simple; just add some alphanumeric character at the end and progress down as you add parts.

When you merge, start with the main body (I am not sure if it makes any difference, but I prefer to move down a logical path… usually)

Below, I have merged the body and helmets together.
https://img102.imageshack.us/img102/2529/merginghelmetszt5.th.jpg (https://img102.imageshack.us/my.php?image=merginghelmetszt5.jpg)

Below I have now merged the new body with swords.
https://img102.imageshack.us/img102/8333/mergingswordsph1.th.jpg (https://img102.imageshack.us/my.php?image=mergingswordsph1.jpg)

You move on and on, continuing to merge your various pieces until you are complete.
https://img523.imageshack.us/img523/8987/convertingtomeshbh4.th.jpg (https://img523.imageshack.us/my.php?image=convertingtomeshbh4.jpg)

Below is the complete model in MilkShape 3D
https://img72.imageshack.us/img72/2781/pikemilitiaug3lodfinishac6.th.jpg (https://img72.imageshack.us/my.php?image=pikemilitiaug3lodfinishac6.jpg)


V. EXPORTING YOUR NEW MS3D BACK TO MESH
Open up GOM’s converter again, Select Convert under the File pull down.

For this you want: MS3D to MESH

Remember to do this for all lods,

After this, replace the vanilla model with your new model under its proper path and then you may now proceed to start M2TW and see your new unit in game


VI. NEW MESH IN GAME

This is the new pike militia in game awaiting their opponents on the field of battle.
https://img523.imageshack.us/img523/6137/newpikesingamesl9.th.jpg (https://img523.imageshack.us/my.php?image=newpikesingamesl9.jpg)

Below are French and HRE pike-militia duking it out with new plumed helmets, short pikes and new swords.
https://img523.imageshack.us/img523/4030/unitcomplete2jh8.th.jpg (https://img523.imageshack.us/my.php?image=unitcomplete2jh8.jpg)


AT

Andromachus Theodoulos
08-17-2007, 18:43
Appendices on Texture mapping

https://img505.imageshack.us/img505/5020/01smoothshadedpikewithppd3.th.jpg (https://img505.imageshack.us/my.php?image=01smoothshadedpikewithppd3.jpg)
Open your Model up in MilkShape 3D

https://img505.imageshack.us/img505/6562/02preparingtoloadtexturlz8.th.jpg (https://img505.imageshack.us/my.php?image=02preparingtoloadtexturlz8.jpg)
Load your Texture under the Materials Tab on the Left hand side. Make sure that your Material for the soldier body is loaded under Figure portion. This is important, otheriwse the soldier texture could wind up on your weapons, shields etc.

https://img505.imageshack.us/img505/2416/03selectplumeandframesenq7.th.jpg (https://img505.imageshack.us/my.php?image=03selectplumeandframesenq7.jpg)
Before working with your mapping for new parts, select the parts in the model window. It is important to select the Faces and not just the vertices, so when you open the Texture Coordinate Window, your model parts will appear.

https://img505.imageshack.us/img505/5482/04initializingtexturecoqh0.th.jpg (https://img505.imageshack.us/my.php?image=04initializingtexturecoqh0.jpg)
The Texture Coordinate Window is found under the Window pull-down.

https://img515.imageshack.us/img515/774/05plumeselectedshowingmqs4.th.jpg (https://img515.imageshack.us/my.php?image=05plumeselectedshowingmqs4.jpg)
Once you have entered the Texture Coordinate Window, go to the model selection on the right hand side and select the portion of the model or Group you would like to map.

https://img515.imageshack.us/img515/6779/06selectingamaphc3.th.jpg (https://img515.imageshack.us/my.php?image=06selectingamaphc3.jpg)
Use the Select button to select your map, just like you would a model piece in the standard modeling view.

https://img515.imageshack.us/img515/8900/07mapmovedjn4.th.jpg (https://img515.imageshack.us/my.php?image=07mapmovedjn4.jpg)
Use the move button to move your map over the correct texture. Notice as you move the 2D representation of your selected model that it will "pick" up the texture it is over.

https://img515.imageshack.us/img515/7641/08showingscaleviewandfeiw7.th.jpg (https://img515.imageshack.us/my.php?image=08showingscaleviewandfeiw7.jpg)
Use the lower "Scale" button, just above "Fit Selection" to "scale" your view, not your texture map.

IMPORTANT: Don't let this throw you, as you are not scaling your texture map, you are zooming.

https://img515.imageshack.us/img515/7681/09usingscalebuttonformasd9.th.jpg (https://img515.imageshack.us/my.php?image=09usingscalebuttonformasd9.jpg)
Use the upper "Scale" button in your tools cluster to scale your texture map.

https://img515.imageshack.us/img515/5364/10feathersnowmappedmn9.th.jpg (https://img515.imageshack.us/my.php?image=10feathersnowmappedmn9.jpg)
Now the feather plume texture is mapped and ready for its glorious showing upon the field of battle...

I hope this section has been helpful...

AT

Andromachus Theodoulos
08-19-2007, 06:45
Place holder for Appendices on RTW CAS conversion and Vertex-Bone assignment in MilkShape 3D

Location of GrumpyOldMan's RTW CAS to MilkShape 3D converter...
http://www.twcenter.net/forums/downloads.php?do=file&id=1321

alpaca
08-19-2007, 21:37
Seems to be good stuff so far, keep it up :2thumbsup:

Monkwarrior
11-03-2007, 23:36
Place holder for Appendices on RTW CAS conversion and Vertex-Bone assignment in MilkShape 3D

Any possibility of having this part of the tutorial?
I'm really interested in moving all my work from RTW to M2TW.
(and I've remarked that it is not straightforward :no: )