Tutorial: Character mesh mod

User avatar
aman
Mortal
Posts: 30
Joined: Tue Jul 14, 2015 2:57 pm

Tutorial: Character mesh mod

Post by aman »

How I replace MK9 character mesh. Its a long process and I will build up this tutorial over time. Tools was developed for latest Stream edition MK9 file format, and only tested with CHAR_Skarlet.xxx. I suggest first replicate steps here exactly before trying other character.

Prerequisites:

- Read the texture replacement tutorial and learn how to extract and replace texture in xxx file http://www.mksecrets.net/forums/eng/vie ... =84&t=6311
- have a uncompressed CHAR_Skarlet.xxx file ready and extract Skarlet.SkeletalMesh from it.

Mk9 skeletalmesh blender import/exprot plugin: This is based on RER mod tool from maliwei777 with changes form marionkart64n and Sectus. I converted it to blender plugin and add support for MK9 skelealmesh
v0.2: http://www.mediafire.com/view/av1l4lim8 ... ol_v0_2.py
Remember first go to Blender "File->Userpreferences" and remove old version addon if you had one installed before http://www.mediafire.com/convkey/3895/5 ... 4ivl9g.jpg

Older tool release:
v0.1: http://www.mediafire.com/view/ggtd90979 ... ol_v0_1.py

Change logs:
v0.2: calculate per vertex tangent and bi-normal before exporting mesh, they are needed to create bumpiness (normal mapping)
v0.1: initial release

A modifiied skeletalmesh will have bigger size than original. HowardC has a generic Injector but it seems it cannot inject file bigger than original into xxx file.
If that is the case I have my own mesh injector here :http://www.mediafire.com/download/wfrmn ... mk9mesh.7z
- First use uModel to dump a catalog of xxx file "umodel.exe -list CHAR_Skarlet.xxx > content.txt
- Search in content.txt for "Skarlet" SkeletalMesh, you should find something like these:
3294 CAB688 C1EEB SkeletalMesh XRay_Skarlet
3295 D6D573 272CB SkeletalMesh Reflection
3296 D9483E 155AFE SkeletalMesh Skarlet

- 3296 is the sequence id for Skarlet skeletalmesh. to replace it with a new one, do this:
MK9Mesh.exe CHAR_Skarlet.xxx Skarlet.SkeletalMesh.new 3296
- If no error you will get a new.xxx file containing replaced mesh.

If you are a season Blender user , run blender 2.7x and install "io_MK9_mod_tool_v0_1.py" plugin from the download link and go to "Misc" tab on left tool shelf and you can import Skarlet.skeletalmesh to blender and experiment with it. For now please restrict to change some vertex positions in character. A complete mesh replacement guide will come later.

Quick notes about export new mesh: suppose you select Skarlet riight leg mesh (mesh_055) , move a few vertices around and want to export this simple change to a new file:
- Make sure you have only the modified mesh/meshes selected (selected mesh by default has yellow/orange color)
- click "Export skeletalmesh" button in the left tool shelf misc panel
- You then need to browse for the original Skarlet.Skeletalmesh file
- mod tool will read the orignal file, inject the selected mesh back to it and create a skarlet.skeletalmesh.new file with your modification.


1. Prepare the new character mesh. I use an catwoman from DCvsMK game as her proportion and pose match very well to Skarlet. And she only use one color texture . http://raidergale.deviantart.com/art/MK ... -194298964
Export it as wavefront obj file using xnalara.
http://www.mediafire.com/convkey/715a/d ... 8jia7g.jpg
http://www.mediafire.com/convkey/27ce/a ... 1zghzg.jpg

2. Install Blender 3D 2.7 <http://www.blender.org/download/>
3. Launch Blender and click "File" menu -> User Preferences -> "Install From File" " Button
4. look for io_MK9_mod_tool_v0_1.py and select it.
5. click and enable MK9 plugin http://www.mediafire.com/convkey/afaa/8 ... 2nvr7g.jpg Close user preferences window.

6. All the Blender hot key I mention in this guide require mouse cursor inside 3d Viewport to work. If you press a hot-key but nothing happen, check you mouse cursor and make sure it is inside 3d viewport.

7. We will delete all objects in 3d view to make clean workspace. press 'a' key twice and confirm all 3d objects are selected with orange outline. Press 'x' and click "delete" to delete all objects.
http://www.mediafire.com/convkey/23c6/l ... m3bizg.jpg

8. When you make a mistake in Blender, you can pres <ctrl>-z (undo) to undo your mistake. Its a life saver.

9. Click "Misc" tab in left tool shelf windows and click "Import SkeletonMesh" button. Browse for "Skarlet.SkeletalMesh" and click "Import SkeletalMesh" button
http://www.mediafire.com/convkey/24c9/c ... i5mczg.jpg

10. hit 'z' key to switch to wireframe mode, hit numpad-'3' for front view, hit numpad '5' key to switch to ortho-camera. hit <shift>-c to center all objects in view.
http://www.mediafire.com/convkey/0a10/s ... pcfo7g.jpg

11. In outliner window ( right-side of screen) find and click on "ArmObject" object to select the bones rig. http://www.mediafire.com/convkey/f5fb/o ... gsaf7g.jpg

12. Move mouse cursor inside 3d viewport press 'm' key (move to layer) and select layer 2 in the popup window. http://www.mediafire.com/convkey/2150/a ... 0m9ozg.jpg
this move all bones out of our way without deleting them.

13. Import new mesh. Select File menu-> import -> Wavefront (.obj). On the bottom left corner of file browser (may need to click and drag on scroll bar to see it), find "Import OBJ" options and change "Forward" option to "X Forward". Browse and import the catwoman.obj file you exported in step 1.
http://www.mediafire.com/convkey/7315/u ... 901kzg.jpg

14. At first you will not see the imported mesh as it is too small. Make sure mouse cursor is in 3d viewport. press 's' and type '98' and hit <enter> key to confirm. You just scale up the catwoman mesh 98 times. it should now overlap with skarlet's body. http://www.mediafire.com/convkey/fe5b/o ... dd3azg.jpg

15. Click and drag Outliner window scroll bar to bottom. you should find 4 meshes with name "Model001_24_*", these are the 4 body parts of catwoman. They share the same texture. We are going to merge them to one mesh. click on the first Model001_ in the list. hold down shift key and click on the other 3 Model001_* names. you should notice the cat woman meshes are all selected in yellow or orange color. http://www.mediafire.com/convkey/7374/o ... 5ys87g.jpg

16. move mouse cursor to 3d viewport, press ctrl-P and select "Object" , that make one of the select mesh parent of the other 3. http://www.mediafire.com/convkey/9e24/n ... ph49zg.jpg
Press ctrl-j , that join all parent-child meshes into one mesh. http://www.mediafire.com/convkey/4033/3 ... pp057g.jpg

17. Need to adjust new mesh position to match skarlet's. NumPad keys (1 ,3,
7 ) change viewpiont to front, side and top view. Press NumPad='7' switch to top view.
Press <shiift>-c put meshes in center if some of them are out of view.
Press <shift>-b (box zoom) and click and drag to draw a box around right hand. you will get a zoom in view of right hand and find new mesh's hand is not completely covered by skartlet's hand. New mesh is too far off to the left.http://www.mediafire.com/convkey/379f/l ... ao40zg.jpg

18. Press 'g' ( grab ) , new mesh turn white. Tap right arrow key a few time until you see new mesh's thumb overlap with skarlet's thumb. Press <enter> key to confirm changes.http://www.mediafire.com/convkey/f296/f ... vwkjzg.jpg

19. Press numpad-3 switch to fornt view. press ''m' key and select the 3rd button in popup window to move catwoman to layer 3. http://www.mediafire.com/convkey/530d/5 ... r2t87g.jpg

20. Transfer bones weight from Skarlet to new mesh. This make new mesh deform following skarlet's moves in game. We don't transfer bone weight from all Skarlet's meshes, only the outer skin meshes. If I selected internal organs or bones by mistake and transfer their weight to new mesh, it may deform out of control or even crash the game.

21. Press 'z' key to change viewport to solid shading. ctrl-c to center mesh in view. press 'a' key twice to make sure no mesh is selected (no orange outline). Press 'b' key and click and drag a narrow box down center of Skarlet. This will select all mesh in her body and legs. If you did not get the selection right, control-z (undo) and try again. http://www.mediafire.com/convkey/ba9a/5 ... gsfezg.jpg
http://www.mediafire.com/convkey/4419/c ... yr1yzg.jpg

22. Hold down shift key and right click on the finger tip of left hand and then shift-"right click" on finger tip of right hand. That will add the two arms meshes to the selection set. This can be tricky to do when viewport is small , again use control-z to undo if pick the wrong mesh and repeat the shift-right click. http://www.mediafire.com/convkey/d4b9/b ... rps2zg.jpg

23. Press 'z' key to change viewport back to wireframe view. Now we have all Sharlet's skin meshes selected, press <shift>-d and hit <enter> key. That made a duplicate copy of selected skin meshes, you should see a number of new entries with name "Mesh_nnn.001" in outliner window.http://www.mediafire.com/convkey/c87c/g ... l40szg.jpg
Press ctrl-p and select "Object" in popup http://www.mediafire.com/convkey/d4c1/5 ... umb4zg.jpg
Press control-j to join the all duplicated meshes into one mesh. If done right , there should only be one "Mesh_nnn.001" left in the outliner.
http://www.mediafire.com/convkey/25bf/z ... c4m4zg.jpg

24. press 'm' (move to layer) and select 3rd button in popup to move Mesh_nnn.001 to layer 3 ( same layer we place catwomen's mesh earlier).

25. Now will be good time to save a copy of your Blender project.

26. Left click in outliner window mesh "Mesh_055" to select it
http://www.mediafire.com/convkey/d266/z ... 25gtzg.jpg.
press 'x' and click "Delete" in popup to delete mesh. http://www.mediafire.com/convkey/6983/l ... fuef7g.jpg

27. Press 'a' key once, all Skarlet's mesh will be selected (in orange). In left side tool shelf window MK9 mod tool panel , click "To Select mesh" button. This bind all meshes to only one bone( bone #1). They will not deform by animation from now on. http://www.mediafire.com/convkey/7e90/b ... rutv7g.jpg

28. press 's' key and type '0.01', then press <enter> key. this scale all meshes down 100 time. You can still see the mesh origin axis marker. press 'g' (grab) key and use mouse or 'up arrow' key until you see the axis marker is in the center of the viewport, press <enter> or left click to confirm the move.http://www.mediafire.com/convkey/e502/3 ... w7br7g.jpg

29. We will work in layer 3 and finish the bone weight transfer. At bottom of 3D viewport find the layer selection buttons, click on 3rd button from left ( it has a dot in center).
http://www.mediafire.com/convkey/2e36/n ... a1d47g.jpg

30. You should see both catwoman and Sharlet skin in layer 3.

31. Right click on Skarlet's sword to select her skin , selected mesh turn yellow.
http://www.mediafire.com/convkey/e983/x ... 918mzg.jpg
<Shift>+<right click> on catwoman mesh add it to the selection. catwoman mesh turn yellow. http://www.mediafire.com/convkey/c183/i ... cjtl7g.jpg

32. At bottom of 3d viewport , click "Object mode" button and select "Weight paint" from list. http://www.mediafire.com/convkey/8ad6/c ... hqd9zg.jpg

33. Catwomn turn blue. In left tool shelf window click on "Tools" tab , scroll down with scroll bar , find and click on "Transfer Weights" button. It will take a while for weight transfer to complete. http://www.mediafire.com/convkey/4de5/i ... dz337g.jpg (If you are using Blender 2.74 and later, in the option panel/menu below transfer button, change the "Source Layer" option from "Active Layer" to "All Layers" , that should transfer all bone groups to your new mesh.http://www.mediafire.com/view/lt4ay7im6 ... ansfer.png)

34. Switch back to "Object Mode" (by click on "Weight paint" button and select object mode". Right click once on catwoman mesh and make sure only catwomen is selected.
http://www.mediafire.com/convkey/6d65/n ... j04e7g.jpg

35. Use outliner window scroll bar ,scroll down and find "Mesh001_24_..." object, right click on this object name and select rename from menu. type in "Mesh_055" and hit <enter>. Catwoman mesh now willl replace mesh_055 and become one of Skarlet body meshes.
http://www.mediafire.com/convkey/8f53/4 ... n6iwzg.jpg

press 'm' key and click on first button in popup to move catwoman to layer 1.http://www.mediafire.com/convkey/f196/1 ... v3zz7g.jpg

36. Switch 3D viewport to layer 1. (click on the first layer button at bottom of 3d view) http://www.mediafire.com/convkey/3121/v ... jwd57g.jpg

37. With catwoman in view press 'a' key twice. This select all meshes in current layer, which include catwoman and all the scaled down Skarlet meshes. (all mesh show in yellow color)

38. In left tool shelf window click on "Misc" tab, then click "Export SkeletalMesh", browse for the original Skarlet.SkeletalMesh , click "Export SkeletalMesh" to start the export. When export is done you will find a Skarlet.SkeletalMesh.new file in the same directory as the original. http://www.mediafire.com/convkey/c1ea/9 ... 7smk7g.jpg

39. To inject the modified Skarlet to xxx file :
MK9Mesh.exe CHAR_Skarlet.xxx Skarlet.SkeletalMesh.new 3296


Replace Skarlet Texture: Skarlet body use texture file Skarlet_Diff.texture2D. Use uModel to export Skarlet_Diff.dds. Open dds file in Photoshop/Paint.NET and copy catwoman texture over it save Skarlet_Diff.dds as DXT5 ( following instructions in MK9 texture mod tutorial).
Last edited by aman on Wed Sep 02, 2015 11:18 am, edited 33 times in total.


User avatar
mrs53360
Mortal
Posts: 72
Joined: Sun May 03, 2015 4:04 am

Re: Tutorial: Character mesh mod

Post by mrs53360 »

oh, its so great! keep going

btw umodel can export SkeletalMesh and StaticMesh of Mortal Kombat X. Maybe you can make import/exprot plugin and mesh injector for MKX too?
User avatar
aman
Mortal
Posts: 30
Joined: Tue Jul 14, 2015 2:57 pm

Re: Tutorial: Character mesh mod

Post by aman »

I don't know how reliable'useful this MK9 mod tool turn out to be. I doubt I can spare any time to check out MKX files.
User avatar
HowardC
Mortal
Posts: 48
Joined: Wed Mar 25, 2015 12:27 am

Re: Tutorial: Character mesh mod

Post by HowardC »

Thanks for all the info and tools! I'm more of a 3dsmax guy myself, but I'll give it a go when I get time.


Let me ask you something. With your injector are you simply replacing the file or modifying the header in some way? The reason I ask is we've had trouble increasing the size of a file within a package without causing errors.

It might explain your umodel errors. I made a file appendor a while back to add additional files to the vs packages and it "sort of worked". Umodel had a fit when you tried to open those packages as well.
User avatar
aman
Mortal
Posts: 30
Joined: Tue Jul 14, 2015 2:57 pm

Re: Tutorial: Character mesh mod

Post by aman »

@ HowardC. I modify the file header using my injector but only adjust object start offest and size. Starting offset of all object come after the injected mesh also get adjustment. It seems I run into similar problem you had before.
User avatar
HowardC
Mortal
Posts: 48
Joined: Wed Mar 25, 2015 12:27 am

Re: Tutorial: Character mesh mod

Post by HowardC »

Hmm ok. That means that some of your issues might be from the package itself. I think the question then would be why do exported models turn out bigger? Is it one of those deals where blender just does it's magic and there isn't anything we can do, or is it something that can be stripped out, perhaps manually?

What I discovered with my experiments anyway on the vs packages was that you could make things *slightly* bigger, but after a certain point the game started glitching out. But at the same time the vs jpegs package... you could expand it as much as you liked and the game just didn't care.

I wonder if we can get the Umodel guys involved in this? It might just be some dumb thing in the header that was missed.
User avatar
aman
Mortal
Posts: 30
Joined: Tue Jul 14, 2015 2:57 pm

Re: Tutorial: Character mesh mod

Post by aman »

The export file become bigger is due to how I combine the new mesh with Skarlet's. I deleted one of Skarlet's mesh (i.e the right leg, mesh_055) and rename the catwoman mesh as "mesh_055". I then scale the rest of Skarlet body down and hide them inside catwoman's mesh, selected all meshes and export to a new SkeletonMesh file. Since catwoman mesh has higher vertices count than the right leg mesh it replaced, the new mesh file become bigger. Since I don;t want the old skarlet body to be visible, I might as well edit each of the mesh and make them all contain only 1 face, (cannot be 0 face, that will mess up the skeletalmesh format ). I expect the exproted file will be small after that. All should be more clear when I complete the tutorial.
User avatar
HowardC
Mortal
Posts: 48
Joined: Wed Mar 25, 2015 12:27 am

Re: Tutorial: Character mesh mod

Post by HowardC »

Ahh ok that's a rather clever way of doing it. I've tried mesh swapping in the past, but because we couldn't access the model to change the mesh names it would error out. Your method is suddenly making sense to me.
User avatar
Zentsuken
Mortal
Posts: 37
Joined: Mon Aug 12, 2013 10:34 am
Side: Light

Re: Tutorial: Character mesh mod

Post by Zentsuken »

aman, just wanted to extend my thanks once again for taking the time to post your findings and writing this detailed tutorial, it's truly appreciated!
User avatar
aman
Mortal
Posts: 30
Joined: Tue Jul 14, 2015 2:57 pm

Re: Tutorial: Character mesh mod

Post by aman »

No problem. I hope those who follow this tutorial can make it better. I first learned mesh modding process from Resident Evil 6 modding community and thought this technique can be applied to other game. But of course RE6 has very different mesh format and no special mechanic like "fatalities".
User avatar
LilGrim
Mortal
Posts: 6
Joined: Sun Jul 21, 2013 11:13 pm
PSN: Grim Doe
Location: Purgatory
Contact:

Re: Tutorial: Character mesh mod

Post by LilGrim »

aman,
This is truly amazing and thank you for your hard work :)
Image
User avatar
federicodemiso
Mortal
Posts: 2
Joined: Fri Aug 14, 2015 11:52 am

Re: Tutorial: Character mesh mod

Post by federicodemiso »

(First I apologize for my bad English) I've been trying something similar with the MKX, I have no intention of replacing the mesh completely, I just want to modify the same mesh and then edit the corresponding texture and UV, to avoid problems with the rigging and polycount. I wonder how the mesh injection is performed.
User avatar
zepterrian
Grand Master
Posts: 659
Joined: Fri Jul 10, 2015 3:50 pm
Side: Light

Re: Tutorial: Character mesh mod

Post by zepterrian »

aman i´ve been trying to repeat the mesh swap on my count and followed every single step you put in your tut but at the moment of testing the results i get an error: "Skarlet is totally invisible". So i went back to blender and touched some things about weight transfer i did not understand and what i get is what you can see in the image i attached where Skarlet seems to be floating out of control..
i think i am loosing something in step 33 when you say:
33. Catwomn turn blue. In left tool shelf window click on "Tools" tab , scroll down with scroll bar , find and click on "Transfer Weights" button. It will take a while for weight transfer to complete.
and then in step 34 you say:
34. Switch back to "Object Mode" (by click on "Weight paint" button and select object mode". Right click once on catwoman mesh and make sure only catwomen is selected. i pressed that weight transfer button and it deployed a menu about data and lot of stuffs. then i went back to object mode and kept going ahead.
i think there is a "33-b" step i am missing because i do not have idea how to use blender at all and the only thing i´ve been doing is to repeat your steps following every single letter like i said before. if that´s the case can you tell me how to finish that bone transfer procedure?.if it´s not where is the error then? i really want to complete the task. i´d be very thankfull if you answer..
Attachments
Cat test.jpg
Last edited by zepterrian on Sat Mar 11, 2023 10:31 pm, edited 2 times in total.
For the raptor race...
User avatar
aman
Mortal
Posts: 30
Joined: Tue Jul 14, 2015 2:57 pm

Re: Tutorial: Character mesh mod

Post by aman »

@hunter92 I camnot tell from you description what well wrong, it seems your mesh is tied to just the hip bone only. Maybe in Step 22 and 23 you picked some internal meshes by accident for creating the bone weight source mesh.

Here is my cat women blender file http://www.mediafire.com/download/7288s ... _mk9.blend
It contains the exact bone weight mesh that work for my test. You can go to layer 3, delete my cat women mesh , import your mesh and start from step 31 and transfer the bone weight to your mesh again. follow the rest of the steps to export your character. Hope this fix you problem.
User avatar
aman
Mortal
Posts: 30
Joined: Tue Jul 14, 2015 2:57 pm

Re: Tutorial: Character mesh mod

Post by aman »

@federicodemiso The MKX skeletalmesh format need to be mapped out before mesh injection works , hopefully it is not too different from MK9 format. Unfortunately I don't have spare time to investigate MKX at this time.


Edit: My English is bad too :). I assume you already found out where the vertex data is stored in MKX mesh file. Since you only want to edit the uv of a character, you need a tool to dump the uv data to a 3d modeler friendly format , like wavefront obj file. Import obj file to a modeler (i.e. Blender) and modify UV using uv editor. export uv to obj file. Need another tool to copy uv back to MKX mesh file. I have some old code that do similar thing. I just don;t know yet where the vertex data are in MKX.

How texture got assigned to mesh is still not clear to me. Right now I just overwrite the original texture and it will be replaced for the mesh that is using that texture. I figure I need to study uModel in more detail to find out how texture get assigned to mesh. Again, don't know when I get time to do that.
Post Reply

Return to “Mortal Kombat 9 PC Modding Tutorials and Discussions”