Jump to content

Combining ped meshes (How to mix and match clothes for a ped)


cp702

Now that the issues with OpenIV and ped export/import have been fixed, you can edit default ped models. Doing much more than basic model editing is kind of complicated, and requires 3D modeling knowledge.

However, there is one very useful thing you can do without knowing 3D modeling: combining different ped meshes.

What is a ped mesh? It's a component like head_002 or uppr_001. For example, for skinny cops, the long sleeve shirt is one mesh, and the leather jacket is another. By combining them, you can have cops with only short sleeves and jackets; cops with state trooper pants; state troopers with a regular cop's long sleeve shirt (instead of their weird one); etc.

So how does this work? To start with, you need OpenIV. OpenIV can export .wdd files to its own format, called openFormats. Crucially, openFormats are text-based. To export a model to openFormats, first navigate to componentpeds.img (click the arrow next to GTA IV or EFLC, under pc\models\cdimages).

Then, right click it, and select "Export to openFormats (.odd)".

Make a new folder somewhere, and select it. Then, hit "OK".

Open the .odd file in your favorite text editor.

Each gtaDrawable section represents one mesh. It doesn't contain the actual mesh; all it does is to tell OpenIV about the mesh when you import this back in at the end, so OpenIV can set up the .wdd properly. Let's look at one section of it:


gtaDrawable lowr_001_u

{

shadinggroup

{

	 Shaders 2

	 {

		 gta_ped.sps LOWR_DIFF_001_A_UNI LOWR_NORMAL_001 35.00000000 0.20000000 1.00000000;0.00000000;0.00000000 LOWR_SPEC_001 1.00000000

		 gta_default.sps LOWR_DIFF_001_A_UNI

	 }

}

skel

{

	 skel m_y_cop.skel

}

lodgroup

{

	 mesh

	 {

		 high 1 m_y_cop\lowr_001_u_high.mesh 0 9999.00000000

		 med 1 m_y_cop\lowr_001_u_med.mesh 0 9999.00000000

		 low none 9999.00000000

		 vlow none 9999.00000000

		 center 0.00081600 0.07059900 -0.52030600

		 radius 0.54099200

		 aabb.min -0.23394000 -0.14672600 -1.00492300

		 aabb.max 0.23622800 0.28086400 -0.02737300

	 }

}

}



Seems complicated, right? We don't actually need to worry about most of it. Let's go through line-by-line:


gtaDrawable lowr_001_u


This is the mesh name. The lowr_001_u tells OpenIV what mesh it's dealing with. The lowr means that this is a lower-body mesh (i.e., a pair of pants). The 001 is the number of the mesh. The rule for these is that they have to be unique within a given type, and range from 000 to 00n, where there are n+1 meshes of that type (i.e., there is lowr_000_u and lowr_001_u; uppr_000_u through _003_u; etc.) Worry about this at the end.

I don't know what the _u is; since we're not making our own meshes, just keep it _u if it started as _u (which seems to be clothes), _r if it started as _r (seems to be heads), etc. All you would ever need to change is the number; the lowr_ and _u should stay the same.





gta_ped.sps LOWR_DIFF_001_A_UNI LOWR_NORMAL_001 35.00000000 0.20000000 1.00000000;0.00000000;0.00000000 LOWR_SPEC_001 1.00000000

gta_default.sps LOWR_DIFF_001_A_UNI



Ignore the numbers. All you need to care about is the LOWR_*_001_* parts. Those represent textures for the model. Now, GTA seems to select ped textures its own way; read my tutorial on ped textures for details. This probably just controls OpenIV's preview of the ped. Even so, you may as well update it when you have to. Again, all you'd change is the number in there.





skel m_y_cop.skel



This defines the skeleton that this mesh maps to. You want it to be the same as the name of the odd file, but .skel instead of .odd.





high 1 m_y_cop\lowr_001_u_high.mesh 0 9999.00000000

med 1 m_y_cop\lowr_001_u_med.mesh 0 9999.00000000



This is the key part of the section. It tells OpenIV where to find the mesh file. In your folder, you should have seen a subfolder called m_y_cop (or whatever). That has a lot of .mesh files inside. The m_y_cop\lowr_001_u_high.mesh is actually literally a filepath for the mesh.

OK, this explanation of the file format is done. The next post will have a tutorial to do stuff with these files.



How do we do stuff with this format? Some stuff should be clear. For example, let's say we want to get rid of the raincoat (uppr_003_u). We just delete that section in the odd. That's all. (in this case, we'd also delete lowr_001_u, because it's the pants that go with the raincoat, but that's a special thing about m_y_cop). Note also that if we instead had deleted uppr_002_u, we'd have to renumber uppr_003 to uppr_002.



How do we renumber? We need to change the number in the header and in the textures section. Don't change it in the meshes section. This is key: under no circumstances should you modify the path to the mesh.



Now, let's do something cool: adding the white cop head. This is easier than most additions, because the textures for the head are already in m_y_cop.wtd. Here's how we do it:



First, export m_y_cop.wdd (the GTA IV rendition, not the EFLC one. If you have EFLC, you can find this rendition in pc/models/cdimages/componentpeds.img; the EFLC-specific one is in the TBOGT and TLAD directories, and while this would work, the textures aren't already there, so it's harder).



Next, we need the mesh for the white head. Fortunately, as Custo discovered, TLAD's m_y_prisonguard.wdd is just a modified version of IV's cops. In particular, it has all 3 heads (though it doesn't have a raincoat or short sleeves). So, we want to export that to the same folder we exported m_y_cop.wdd to.



Next. open both of the .odd files in a text editor. Find the section called "gtaDrawable head_002_r" in m_y_prisonguard.odd. Copy it into m_y_cop.odd, just before the final closing brace (but after the second-to-last brace). Since it has the right number, all we need to do is change the skeleton. Change it from m_y_prisonguard.skel to m_y_cop.skel. Save the file.



We're now done with the openFormats (see how easy that was?) Now, all that's left is importing it back in. OpenIV can do this too. Go to componentpeds.img, and click the "Edit Mode" button up top. Under "New", select "Import openFormats". Browse to m_y_cop.odd, hit OK, and wait for it to finish. Now, double click m_y_cop.wdd to preview it (this specific feature is why I first started using OpenIV above SparkIV). Select head_002_r, and check that it looks OK. If it doesn't, you made a mistake somewhere (you didback up, right?) It probably does, though. If it does, you're done! Launch GTA and see the white cops now patrolling Liberty City! 



For more advanced mesh combinations, there are additional steps. First, you need to renumber the mesh you add so it doesn't conflict (or, if you remove a mesh, renumber the other meshes so they have the proper range). Other than that, the biggest issue you're likely to face is textures.



GTA doesn't seem to care about the texture you assign in the openFormat. Instead, it matches textures to meshes the following way:


uppr_001_a_uni


reads as


*meshname*_*letter*_*race*

(letter acts like the mesh number). If you read my "Ped Texture Discoveries", you saw more detail on this. What does it mean for you?

Well, let's say you delete a mesh, renumber, but don't fix textures. What you get is the texture for, say, the long-sleeved shirt being applied to the jacket. This can look really weird, and is definitely not what you want. So, what you have to do is delete the textures for the mesh you removed, and renumber the higher textures. To rename a texture in OpenIV, make sure you're in Edit Mode, open the wtd, and double click the specific texture. Enter your new name. To delete a texture, highlight it and hit "Delete" on your keyboard. Obviously, you have to delete or rename a texture before you can give another texture its name.

Also, if you have added a mesh, you need to add textures for it. What you want to do is drag the appropriate textures from OpenIV to some folder (click the name on the left of the wtd browser, and drag to Windows Explorer). They'll show up as PNGs. Renumber the textures by changing the number in the file name. Then, open the wtd for the model you're changing, and drag the PNGs to the window. Hit "OK" for mipmap generation, and you're done.

Any questions? Comments? Other ped modelling information? Post below!



User Feedback

Recommended Comments

Good I did this kind of thing for San Andreas, I took GTA IV police ped skins, used converted original ped models form IV to SA and installed them!

Share this comment


Link to comment
Share on other sites

Everytime i edit the TBOGT so i have all the fire gear (helmet, jacket, pants, SCBA) when i save it converts it to a .txt file so i cant reimport. please help. also could this work for vehicles? (remove lightbars/rambars/skins/etc?)

Share this comment


Link to comment
Share on other sites

@Rollyhood: You can't do this for vehicles yet, as OpenIV can't export .wft files to openFormats. To stop it from becoming a .txt, put quotes around the filename in the save dialog.

@Smiley: Yes, it does. Just do this on the pedprops model, not the cop model.

Share this comment


Link to comment
Share on other sites

Hi cp702 , I've done exactly what you wrote but i can't drag out the textures as PNG , i get them as DDS and now my model is totaly white .. solved ;)

Share this comment


Link to comment
Share on other sites

-snip-

Would you be able to tell me what I've done wrong here? http://pastebin.com/yaW4jXBg

I'm trying to copy the glasses off the m_m_gunnut_p model. It shows up perfectly in OpenIV but Simple Native Trainer only shows the default glasses being available.

Share this comment


Link to comment
Share on other sites

Would you be able to tell me what I've done wrong here? http://pastebin.com/yaW4jXBg

I'm trying to copy the glasses off the m_m_gunnut_p model. It shows up perfectly in OpenIV but Simple Native Trainer only shows the default glasses being available.

 

IIRC, SNT hardcodes how many meshes are available in each prop slot, so you have to turn off TrainerMappedHatsAndGlasses or something like that in order to get it to let you select new props.

Share this comment


Link to comment
Share on other sites

IIRC, SNT hardcodes how many meshes are available in each prop slot, so you have to turn off TrainerMappedHatsAndGlasses or something like that in order to get it to let you select new props.

Yep, just found that out yesterday. Got desperate and started googling every combination of keywords I could think of till I found it on the SNT post on gtaforums.com. Thanks for the reply though. I feel like a tool for assuming it wasn't anything to do with SNT. :P

For anyone else having the same problem, go in your trainer.ini and look for "Modelhats" and change the value.

Share this comment


Link to comment
Share on other sites

-snip-

Excuse the double post, but I just remembered something else I'm having trouble with now. Is there an easy way that I can reposition objects in the pedprops.img such as glasses? Or would I need to use 3DMax or something to readjust it on the skeleton?

Share this comment


Link to comment
Share on other sites

I replaced one of the traffic cop heads with the black regular cop, it shows up perfect in OpenIV, but it's still the old head in-game? 

Share this comment


Link to comment
Share on other sites

There's a ped that's usually used for K9 and stuff, he's got a drop holster, would I be able to merge that with another ped? Like a state trooper or something? If so, does this forum help? It seems to have a TON of scripting and stuff... But, I'm pretty stupid when it comes to things like this, all I know how to do is go PEW PEW PEW and skin. :P 

Share this comment


Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×