lfnetwork.com mark read register faq members calendar

Thread: Merging Models Tutorial
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 07-06-2006, 08:39 PM   #1
Kha
Rookie
 
Kha's Avatar
 
Join Date: Oct 2005
Location: Brazil
Posts: 169
Merging Models Tutorial

Original Thread for Discussion

Hi,

Lord Spartan asked me if I could explain better how to merge models, so I decided to make a tutorial step by step, this first part is about loading the file in Gmax and organizing the workspace. I'll be using the model pmbil as a base, and we will merge another body model mesh.

___

1. The Tools


1.The Kotor Tool by Fred Tetra you can find here:
http://kotortool.starwarsknights.com/

2.MDLops by Cchargin:
http://home.comcast.net/~cchargin/kotor/

3.Gmax, if you are new to 3d modelling you should download the tutorials and help files too:
http://www.turbosquid.com/gmax

4.Nwnmax for Gmax:
http://nwmax.dladventures.com/

5.Taina's Replacer:
http://www.pcgamemods.com/mod/11335.html



2. Loading the model


Once everything is installed and working let's create a folder for the project....I'll call it NewRobes. Next we extract the pmbil model from the game to NewRobes folder, to do that open Kotor Tools and select:
Kotor I -> BIFs -> models.bif -> Aurora Model -> pmbil.mdl
Then press the button “Extract File” and save the file on NewRobes folder.



The model's name is codified:
p -> player model
f or m -> female or male model
b or h -> body or head model
a or b ->underwear or cloths model
l, m or s -> large, medium or small body (soldier, scout or scoundrel)
a, b or c -> asian, black, caucasian skin colour (for heads) the number is the portrait used.

Extract the .mdx file and save in the same folder.
Kotor I->BIFs->models.bif->Aurora Model Extension->pmbil.mdx
To extract the texture used by the model:
Kotor I->ERFs->TexturePacks->swpc_tex_tpa.erf->P->pmbi01.tpc



If you don't know which textures the model uses I'll show you later how to find it. If you double click over image the image viewer will show it, if there is nothing written in the white box we can press the “Extract file”, select “Save as tga”, and save it in the same folder.



But our texture has a text there, so we will copy it to a text file too, to do that we check the “Export Selection to TXI file”, select the text, press “Write File”, we save it in the same folder as the model files.



Now in NewRobes folder we have four files pmbil.mdl, pmbil.mdx, pmbi01.txi and pmbi01.tga.



We are going to convert the pmbil.mdl from binary to ascii file, using MDLops. Start MDLops, activate “Kotor 2” button, and press “Select file” button, and select the file pmbil.mdl.
I usually let the “Extract animations” checked, I have seen some tutorials that says it should be unchecked though... Then press the “Read and Write model”, it will create a pmbil-ascii.mdl and pmbil-textures.txt file inside the NewRobes folder. The pmbil-textures.txt file tells which textures is used by the model, it is very useful if the model uses many textures with different names.

Now we start Gmax, remember to start Gmax not using its icon, but using Nwmax's icon, it will start the Snooper script too, without it you will have to paste the text from the Gmax's listener and copy on a text file to export the model. Gmax will start and the Nwmax roll-out will open.



To import the model we select it in the Nwmax roll-out “MDL Loading”, in the file name we use the browse button to select our pmbil-ascii.mdl file, in Options check “Import Geom Only” and then press “Import” button. The model and a lot of other stuff will appear in the screen. Minimize the Nwmax roll-out.



On the screen we have 4 panels...the Top, Front, Left and Perspective views, when you click inside one of the panels it is activated and it is shown by turning its board gray instead of the default dark blue.



You can change one panel to the other right clicking on the panel's name and selecting it in the menu, or using the shortcuts, T to top, B to bottom, L to left, R to right, F to front, K to Back (on Kotor models front and back are reversed), P to perspective, U to user view.



continue....


"Who we are depends on who we create ourselves to be."

My Kotor Mods

Last edited by ChAiNz.2da; 07-07-2006 at 04:05 AM.
Kha is offline   you may: quote & reply,
Old 07-06-2006, 08:54 PM   #2
Kha
Rookie
 
Kha's Avatar
 
Join Date: Oct 2005
Location: Brazil
Posts: 169
Now with the perspective panel activated we go at the bottom right of the screen where there are some tools to manipulate the visualization of the 3d space.



Some tools have only one option of use, but others have a small arrow on the right below it, if you put the mouse over the icon it will shows what the tool does, if you click on the icon it will turns orange showing that it is activated, if you hold the click it will show the other options for the tool as more icons, and to deactivate it just right click on the panel.



The default icons are from left to right and top to bottom,:
Zoom (shortcut key Z);
Zoom All – it zooms on all panels at same time (shortcut key assignable);
Zoom Selected – zooms selected objects (shortcut key E) or Zoom Extents (option)– zooms all the objects in the scene (shortcut key CTRL+ALT+Z);
Zoom Selected All – zooms selected objects in all panels (shortcut key assignable) or Zoom Extents All (option) - zooms selected in all panels (shortcut key SHIFT+CRTL+Z);
Field-of-view (works only on perspective panel – works as a zoom) or Zoom Region (option) – zooms a piece of the space delimited by the mouse (shotcut key CTRL+W);
Pan – moves the panels to the sides or up-down (shortcut key CTRL+P);
Arc Rotate – rotates the view (shortcut key V or CTRL+R);
Min/Max Panel – minimizes and maximizes the panel (shortcut key W);

So, with the perspective panel activated let's click on the “Min/Max Panel” (shortcut W), and it will increase the Perspective panel to fill the place of the 4 original panels.

Now use the visualization tools to see what we have on the 3d space... remember that if you want to undo the visualization you need press SHIFT+Z and to redo SHIFT+A.

I've used the arc rotate and zoom to get the image on the left on the maximized perspective panel. Here in the 3d scene we have the painted model's mesh which is the model that we see in the game.



There are some wire blue boxes , they are called helpers, they are used by the game to place other models or visual effects on the model's body. We should not change them, and we will use the bigger one at the base of the model to export it back to the game.

There are some colored solid polygonal forms, they are the bones, it means that if you move or rotate them, the body's mesh will deform or move to follow the movement. We will not use them yet, they are only used on Gmax when we need to fix the bones deformations, we will do it after the modeling and texture is done because if we change the number of vertices of the model the bones weight on each vertex will be recalculated and we lose part of the work done, this bones are used to create the character's shadow in the game too. And there are some white wire tetrahedron and icosahedron forms, they are bones too, but they are used to place the solid bones.

Let's save the file, go to the “File” menu and select “Save” choose a name and after the name add a number (for example: Robes_01) save it in the NewRobes folder.

Now, next time we save it after we have made a big change on the model we can use the “+” button that appears in the save dialog windows and it will save it as a new version, if you don't want to save as a new version you can use the CTRL+S to save over the file.



So let's select only the meshes and hide everything else that we won't be using by now, when we click on the “Select by name” icon (shortcut key H), on the top tool bar in the screen.



It will open the “Select Object” window check the “Display Sub tree” this will show a tree showing the hierarchy between the meshes, which are linked. In the list we will select the names, with the CTRL key pressed: torso, LArm, Rarm, feet.



Those are the meshes that of body, that we see in the game, once they are selected in the list, press the “Select” button, and in the 3d scene you will see those meshes with a white wireframe around it, to show that they are selected.



Now we will save this selection, with those 4 meshes selected write on the white space of the upper toolbar the name of the selection (for example: Mesh), then press the ENTER key.



To deselect those meshes click with the left mouse button on the 3d scene, now if you want select the meshes back, just select it on the toolbar using the arrow to browse the names of the selections.



With those 4 meshes selected, let's hide them clicking with the right mouse button in the 3d scene a red menu will appear, select “Hide Selection”.



Now we are left with only helpers and bones, let's separate them too... in the “Select by Name” icon open the “Select Object” window and select everything that has an _g at the end of the name, it will select all the bones, if the window closes, just call it again and continue the selection. Once you are done call the red menu and use the “Hide Selection”, if there is no bone left on the scene undo the hide (CTRL+Z) and name the selection as Bones and hide them again, now we have only the helpers.

continue....


"Who we are depends on who we create ourselves to be."

My Kotor Mods
Kha is offline   you may: quote & reply,
Old 07-06-2006, 09:02 PM   #3
Kha
Rookie
 
Kha's Avatar
 
Join Date: Oct 2005
Location: Brazil
Posts: 169



Select all that is left using the “Selection by Name” icon and create another selection called Helpers, and hide them too.
Now we call back the mesh just selecting it on the name of the selection, a warning box will appear to tell that the objects of that selection is hidden and asks if you want it to bring them back, click yes.



Now we have only the 4 meshes on the 3d scene, it is a good time to save your work.

There is a problem with the uv map of the model, the texture is not in the right place, but as we are not going to use it anyway there is no reason to worry.




One important step is chose the right base mode for the model we are going to merge, in the model we've choosen (pmbil) the feet and gloves are separated from the whole torso, so the mesh we are going to add must be separated the same way, otherwise we will have problems with the bones as their configuration fits how the mesh is separated.



We can use a model that already have the same separation, Carth's cloths for example would fit well as it is separated the same way, or we can remodel our model to fit it.



Here I remodeled Carth's cloths to fit his underwear bone configurations.



That is how I load the base model, in part II we will see how to import and merge the new model.


"Who we are depends on who we create ourselves to be."

My Kotor Mods
Kha is offline   you may: quote & reply,
Old 07-11-2006, 11:45 AM   #4
Kha
Rookie
 
Kha's Avatar
 
Join Date: Oct 2005
Location: Brazil
Posts: 169
Here is the second part, not the merging yet... but it is coming!
___

3. Preparing the model

Now we are going to work in the mesh we want to merge in our base, there are three reasons we want to merge meshes on the bases:
1.we have a new model modeled on another 3D program or even in Gmax/3DMax but it is a file without all the aurora base polygons/helpers/bones.
2.we want to merge parts of different models, for example, the torso of one model, the legs of other and the arms of a third one.
3.we have remodeled a body model from one game and want to port it to the other. If someone knows a better way to do it let me know, but remember that porting is illegal, only do that if the model you worked with is in both games.
I'll cover all those situations, the 1st and 2nd requires some modeling and UV editing/texture painting, and all of them will require bone weighting. So in this part we will talk about how we go into modeling in Gmax.

3.1 Importing a new model into Gmax.
Lord Spartan exported one of the body meshes to another program to remodel it, that is why he asked about merging, how he can add his new model into the game? So I have here the 3DS file of his model and we are going to import it into Gmax.
Start Gmax and open the file we loaded in the first part of this tutorial (Robes_01.gmax) and hide everything.
In the “File” menu click in the “Import”, choose the .3DS file and click ok in the 3DS Import warning, with “Merge objects with current scene” checked.



And in the next 3DS Import warning click no.



As this model was extracted from the game it follows the same division as the original model, the torso is separated from the arms and legs. But even if it was one whole piece we could just cut them to fit the bone setup. And both models are the same size.



With all those separated parts selected let's save this selection the same way we have done with the bones, helpers and mesh, name this selection model.



So let's see how the original model was constructed and them compare with our new model to see if it requires any modeling. Hide the Model Selection and unhide the Mesh selection.



Select only the torso by clicking with the left mouse button over it, and click on the “Modify” icon on the Gmax roll-out.



Here is where we control what we are changing in the model. Under the “Modify” icon there is the name of the mesh, in this case Torso, and the “Modifier List”, with the “Skin” and “Editable Mesh” modifiers.



Those modifiers are applied to the mesh to modify it somehow, using the “Editable Mesh” modifier we can move, delete, create vertices in the mesh, it is here that we model the it.

The “Skin” modifier is used to apply the bones to the mesh, and to change the influence of the bones over the vertices of the mesh. We shouldn't change the order that the modifiers are applied on the mesh.

If we wanted to change the mesh texture we would need to change the meshes' Uvmap for that we apply the “Unwrap UVW” modifier on the Torso mesh.

Select the “Editable Mesh” modifier, because we want apply the “Unwrap UVW” modifier over the “Editable Mesh” one, when you select it a warning will appear to tell you that there is another modifier, the “Skin” that depends of the “Editble mesh” and if you change or add something between them something weird can happens, just say yes.



Now we click on the arrow beside the Modifier list, a big list of modifiers will appear and we select the “Unwrap UVW” in the “UV Coordinate Modifiers”.



Ok, we have the 3 modifiers we need to change our model to use it in game, under the list there are some icons, the second one (show end result on/off) when it is active it is white and it shows the effect of all the modifiers applied to the mesh on the 3d scene, when it is deactivated it is half white and half gray, it shows only the effect of the modifier selected. Some modifiers doesn't allow it show the effect of others... for example the “Editable Mesh” when selected, it doesn't allow the “Skin” modifier shows its effect, even if icon is white. The light bulb turn on/off the modifier, but you can not see the difference now.



continue....


"Who we are depends on who we create ourselves to be."

My Kotor Mods
Kha is offline   you may: quote & reply,
Old 08-06-2006, 08:38 PM   #5
Kha
Rookie
 
Kha's Avatar
 
Join Date: Oct 2005
Location: Brazil
Posts: 169
As I was filling the holes from the robe mesh I've noticed that some faces was modeled with both sides, the inside and outside, so the inside faces should be deleted too, because it will not be seen by the player and the game will have to spend time to render it.

When you create faces in Gmax it only gives the outside face, if you look inside the model the mesh appears to be transparent, you only see the border of the separated elements.



That is why you have to create it anti-clockwise. If you create a face clockwise it will build the face inside the mesh.



This is the modeled mesh and the original one from the game and we are looking inside their arms, in the modeled I need to remove all the faces inside, and leave only those that we want to be seen, like those near the glove. And because it will take time we are going to see how to put together pieces of different models.



3.3 Merging pieces of different models

Jolly Boots asked once how he could remove Atton's jacket and give him the torso of the underwear's male, so that is what I'll explain here in more detail. The first thing I'm going to do is create a folder called “Atton” and using “Kotor Tool” we will extract the files of the male underwear pmbam, and Atton's cloths P_AttonBB:

KotorII->BIFs->models.bif->Aurora Model->pmbam.mdl
KotorII->BIFs->models.bif->Aurora Model Extension->pmbam.mdx
KotorII->ERFs->TexturePacks->swpc_tex_tpa.erf->P->pmbamc01.tga

KotorII->BIFs->models.bif->Aurora Model->p_attonbb.mdl
KotorII->BIFs->models.bif->Aurora Model Extension->p_attonbb.mdx
KotorII->ERFs->TexturePacks->swpc_tex_tpa.erf->P->p_attonba01.tga

Now using “MDlops” we press the “Select file” button, select pmbam.mdl file and with “Kotor 2” button enabled we press the “Read and write button” we do the same with p_attonbb.mdl file.

Start Gmax using the Nwmax icon, and import the model P_AttonBB-ascii.mdl.

We call the “Select Object” window using the “Select by Name” icon, and now we select all the meshs that have an _g in its name's end.

We name this selection Bones in the text field, and then we hide the selection pressing the right mouse button and selecting the “Hide Selection” from the menu.

We create another selection called Meshes selecting eyeLA, eyeLid, eyeRA, eyeRlid, teethDWN, teethUP, JacketFlapNew, ShirtFlapNew, LArm_Geo, RArm_Geo, Head_Geo, and we hide those too. Then we select all the boxes left and name it Helpers.

Now we select the Meshes selection, say “yes” to the warning window and we will have only the meshes visible. We already have seen all this in my first post of this tutorial.



One important thing to remember is that the flap of his shirt and jacket will not move any more when we export it to the game using MDlops, if you select the flap you will see that there is an “AuroraFlex” modifier in it, only Taina's Replacer can export it back to the game, but then we will not be able to change the number of vertices of the model. But as we are not going to use his jacket we don't need to worry about it.



From this model we are going to use only its pants, shoes and belt, the arms and torso will be from the underwear model. Let's take a look on the underwear model to decide which model will be used as a base model, save this file as Attonbb_01.gmax and reset Gmax selecting in the menu “File->Reset” and “yes” in the warning window.


Now import the pmbam-ascii.mdl to Gmax, and create the Meshes, Bones and Helpers selections as we did with Atton's cloths model, for the Meshes selection select only RArm, LArm and Torso meshes, and make only this selection visible... in my model the texture didn't come with the model, in the pmbam-textures.txt file that MDlops created it says I should have used the pmbama01.tga texture and not the pmbamc01.tga that I extracted using Kotor Tool , but as the pmbama01.tga is the asian skin color I'm going to put the pmbamc01.tga texture in the model using Gmax.



To add the texture we press the “Gmax Material Editor” icon to call the “Material Editor” window.



In the “Material Editor” window we press the “New” button and it will open the “New Material” window, where we select “Standard” and press “OK” button.



Now we click in the grey color box beside the “Diffuse” name in the “Blinn Basic Parameters” rollout, it will call the “Color Selector” window and we change the color from grey to white.



continue...


"Who we are depends on who we create ourselves to be."

My Kotor Mods

Last edited by Kha; 12-28-2007 at 12:48 PM.
Kha is offline   you may: quote & reply,
Old 08-06-2006, 08:43 PM   #6
Kha
Rookie
 
Kha's Avatar
 
Join Date: Oct 2005
Location: Brazil
Posts: 169
Now in the “Maps” rollout we check the “Diffuse Color” and click in the “None” button beside it to call the “gmax Material Navigator”, here we press the “bitmap” and chose the file pmbamc01.tga.








Now we enable the “Show Map in Viewport” icon and with the mesh torso selected we press the “Apply” button.



Now we select the arms and press the “Apply” button for each one.



When you export the model the name of the bitmap file we used here will be exported with the model, this is a way to change the name of the model's texture without hexedit the model file. And if you want to change the name of the model you need to select the “Aurara Base” mesh and change its name in the modify rollout. Then you will need to change the name of the original pmbam.mdl and pmbam.mdx files to the name you want before compiling the new ascii file Gmax exported using MDlops.



To decide which model will be the base I usually use the one with the arm I need, here we want the underwear arms with the pants, shoes and belt from Atton's cloths, so we are going to use the underwear model as a base, because this way we won't need to bone weight the arms, it is already done and working, and weighting the hand and fingers is a tedious work. Let´s save this file as pmbam_01.gmax.

___
Hope someone is reading all this stuff... any feedback is welcome.


"Who we are depends on who we create ourselves to be."

My Kotor Mods
Kha is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Tutorials: Skinning and Modeling > Merging Models Tutorial

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:50 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.