Jump to content

KURO NO KISEKI mod


Recommended Posts

Posted (edited)

model_tool.png.b072b3f1d240fadcc2cd1ad94982eb1f.png

 

To my fellow modders,

 

I have written a new tool to make vertex group maps that allows for mesh binding to the skeleton!  (As always, latest version will always be at my GitHub).

 

Upload updated - original filename was misspelled.

 

make_vgmap_from_gltf.py

 

How is this useful?  I can think of two things.

  1. Weight painting is achievable now.  You can adjust the paint, and then move the skeleton to see how the model deforms without loading it in the game.  You can (probably?) even run the animations to see if your model looks good!  (I have not tried this.  I am not good at painting.)
  2. Weight transfer is 99.9% easier now!  My tool maps all the weight groups to their proper bones, the names of which are shared across characters.  So now instead of the upper leg being a random number, it will always be "LeftLeg" - which means all the meshes are ALREADY RENAMED when you load them!  Just merge one mesh into the other, and you are done!!

A million thanks to @uyjulian; I dissected his model dumper and figured out how to do this (here is my version).  I know Kuro modding has already cooled down, but I figure this will still be useful because Falcom will likely use this engine for many years.  Also, I think I can adapt this code to the phyreEngine games (Cold Steel series).

 

Here is a tutorial I wrote to use this for weight transfer.

 

As a test, I took @coomi's Agnes towel nude mod, and ported it to Renne (just like my tutorial).  It took less than 5 minutes, and looks so much better than automatic weight transfer.  I suspect you can do other transfers, like Shizuna's jacket onto other characters, but I have not tried.

 

Spoiler

1498650195_2022-10-2023_07_12-TheLegendofHeroes_KuronoKiseki.png.3aa87e9d85b125cfa825d760bbc4fdf6.png

 

How to use:

 

Quote

 

This is an advanced skill.  If you have never modded Kuro before, please see my other tutorials!

 

PLEASE NOTE - Commonly you might only need 1-2 meshes.  I grabbed the whole model for demonstration purposes, you do not need to import so many!

 

First, obtain the meshes that you want using frame dump as usual.  Merge them with my tool as you normally would.  Open the meshes that you want in Blender.  Save the meshes that you want to work with as ib/vb/fmt  (File -> Export -> 3DMigoto raw buffers).  (While I have function calls in my new script to work with the raw text files, Blender cannot open VG Maps when first importing text files so it does not matter.  You need ib/vb/fmt.)  Do not split the buffers yet.  (Notice in the picture, the vertex groups are still random numbers.)

 

Spoiler

557735647_2022-10-2022_24_54-Blender.png.4b901e9114619815edd06489608bf301.png

 

Get the model file from your KURO NO KISEKI\c\asset\common\model folder.  Here I need Agnes' academy outfit, chr_5001_c02.mdl.  If you do not know which model you need, look at @woofhat's list of models.

 

Decrypt the mdl file and convert to gltf, using this script.  Just put it in the same folder as the mdl and double click it.   (Note: CLE files require the python blowfish and zstandard modules to decrypte.  If you have not yet installed these, follow my directions in the linked post.)

 

Put the gltf file and my new script in the same folder as the ib/vb/fmt files you want to map.  Double-click the script.

 

Spoiler

2103468226_2022-10-2022_25_56-Agnes.png.14e0bfc96eefa3af08c7e55593c8ca60.png

 

It will go through the meshes you have, one by one, and ask you which mesh mapping you want to use.  Using Julian's convertor, all the body meshes are combined into one, so pick the body one for most meshes (except hair - for hair please pick the hair mapping of course).

 

Spoiler

1829230489_2022-10-2022_26_41-Window.png.b60acf14af7fa0cd20e3494ef0653cad.png

 

Now re-import the meshes.  You will see that all the weight groups have been named properly!

 

Spoiler

383079119_2022-10-2022_29_44-Blender.png.3c28fe25032e6b2bf2b2cbda8149f19c.png

 

For weight painting, you will want to rig your mesh to the skeleton.  Open the gltf file.  You can hide or delete the three meshes.  I also hide the joints, so you can clearly see the bones and mesh.

 

Select all your 3DMigoto meshes (in the list on the upper right, click the top one, then shift-click the bottom one).  Then SHIFT-click on one of the bones (in the scene, NOT on the list).  You should see the meshes outlined in red, and the skeleton outlined in orange.

 

Spoiler

642733101_2022-10-2022_31_26-Blender.png.f28bc18244eb31ab11404d559b58d6f4.png

 

Press Ctrl-P to parent, and select "Armature Deform."  Do NOT pick any of the "With..." options.

 

Spoiler

101116571_2022-10-2022_31_47-Blender.png.bcea7ac88ee8c24518132ba7ac6b2d26.png

 

The model is rigged!  You can now do what you need to do.

 

Spoiler

1939320281_2022-10-2022_33_30-Window.png.542fff437a713bed08403bf93bef5ef2.png

 

When you are done with your mesh, export as usual (File -> Export -> 3DMigoto raw buffers).  You can now proceed to split the buffers as usual.

 

 

Enjoy!  I look forward to seeing what you do with this and trying out your mods!

Edited by amorrow28
Posted
7 hours ago, amorrow28 said:

model_tool.png.b072b3f1d240fadcc2cd1ad94982eb1f.png

 

To my fellow modders,

 

I have written a new tool to make vertex group maps that allows for mesh binding to the skeleton!  (As always, latest version will always be at my GitHub).

 

make_vgmap_from_gitf.py 7.03 kB · 3 downloads

 

How is this useful?  I can think of two things.

  1. Weight painting is achievable now.  You can adjust the paint, and then move the skeleton to see how the model deforms without loading it in the game.  You can (probably?) even run the animations to see if your model looks good!  (I have not tried this.  I am not good at painting.)
  2. Weight transfer is 99.9% easier now!  My tool maps all the weight groups to their proper bones, the names of which are shared across characters.  So now instead of the upper leg being a random number, it will always be "LeftLeg" - which means all the meshes are ALREADY RENAMED when you load them!  Just merge one mesh into the other, and you are done!!

A million thanks to Julian Uy; I dissected his model dumper and figured out how to do this.  I know Kuro modding has already cooled down, but I figure this will still be useful because Falcom will likely use this engine for many years.  Also, I think I can adapt this code to the phyreEngine games (Cold Steel series).

 

As a test, I took @coomi's Agnes towel nude mod, and ported it to Renne (just like my tutorial).  It took less than 5 minutes, and looks so much better than automatic weight transfer.  I suspect you can do other transfers, like Shizuna's jacket onto other characters, but I have not tried.

 

  Hide contents

1498650195_2022-10-2023_07_12-TheLegendofHeroes_KuronoKiseki.png.3aa87e9d85b125cfa825d760bbc4fdf6.png

 

How to use:

 

 

Enjoy!  I look forward to seeing what you do with this and trying out your mods!

Great work, I'll try to understand the content.

Posted
On 10/21/2022 at 2:55 PM, amorrow28 said:

model_tool.png.b072b3f1d240fadcc2cd1ad94982eb1f.png

 

To my fellow modders,

 

I have written a new tool to make vertex group maps that allows for mesh binding to the skeleton!  (As always, latest version will always be at my GitHub).

 

make_vgmap_from_gitf.py 7.03 kB · 10 downloads

 

How is this useful?  I can think of two things.

  1. Weight painting is achievable now.  You can adjust the paint, and then move the skeleton to see how the model deforms without loading it in the game.  You can (probably?) even run the animations to see if your model looks good!  (I have not tried this.  I am not good at painting.)
  2. Weight transfer is 99.9% easier now!  My tool maps all the weight groups to their proper bones, the names of which are shared across characters.  So now instead of the upper leg being a random number, it will always be "LeftLeg" - which means all the meshes are ALREADY RENAMED when you load them!  Just merge one mesh into the other, and you are done!!

A million thanks to Julian Uy; I dissected his model dumper and figured out how to do this.  I know Kuro modding has already cooled down, but I figure this will still be useful because Falcom will likely use this engine for many years.  Also, I think I can adapt this code to the phyreEngine games (Cold Steel series).

 

As a test, I took @coomi's Agnes towel nude mod, and ported it to Renne (just like my tutorial).  It took less than 5 minutes, and looks so much better than automatic weight transfer.  I suspect you can do other transfers, like Shizuna's jacket onto other characters, but I have not tried.

 

  Reveal hidden contents

1498650195_2022-10-2023_07_12-TheLegendofHeroes_KuronoKiseki.png.3aa87e9d85b125cfa825d760bbc4fdf6.png

 

How to use:

 

 

Enjoy!  I look forward to seeing what you do with this and trying out your mods!

Use  Google Translate

I would like to know what is the difference between the official 3dmigoto and the 3dmigoto in UnSkirt Mod?
Because I can't use "drawindexedinstanced=auto" command in official 3dmigoto. But 3dmigoto in UnSkirt Mod can.

What files did you edit to make 3dmigoto support the "drawindexedinstanced=auto" directive?

Posted
1 hour ago, fateli said:

Use  Google Translate

I would like to know what is the difference between the official 3dmigoto and the 3dmigoto in UnSkirt Mod?
Because I can't use "drawindexedinstanced=auto" command in official 3dmigoto. But 3dmigoto in UnSkirt Mod can.

What files did you edit to make 3dmigoto support the "drawindexedinstanced=auto" directive?


I changed CommandList.cpp and CommandList.h, you can see what I changed here. There have been many other changes, however. The last official release was in 2019!

Posted (edited)

I modified @uyjulian's script for converting MDL to GLTF to be easier to use.  Just put it in a folder with a model file and double-click the script.  It will decrypt and convert any MDL file it finds into GLTF.  Needless to say, do not run this script in your asset folder, it will be converting files for a VERY long time.

 

kuro_mdl_to_gltf.py

 

Information on how to use GLTF models to bind your 3DMigoto mesh dumps to a skeleton for easier weight transfer and weight painting here.  My original post with information uyjulian's script here.  Any updates to this script will be at my GitHub, as usual!

 

Note: CLE asset decryption requires both blowfish and zstandard modules.  Just type this into your command line:

python -m pip install blowfish zstandard

 

Edited by amorrow28
Posted

image.thumb.png.8256464df69e5f2f487cb3bf72d40389.png

Experimenting with AI painting over screenshots. 

Spoiler

This is the starting point, a cropped Kuro 2 screenshot

image.thumb.jpeg.d201215b9695d74a202efd622357bc81.jpeg

I used img2img with NovelAI to make it look like artwork

image.png.8d6ada30681c72737d1dc369e620492e.png

and then removed the towels with inpainting. 

 

image.png.e1340654fbf763f85835f0b317365bf9.png

I ran img2img on this picture again to clean it up

image.png.fbf8c91c34b6d31ef71ab6a9389351a3.png

I upscaled this image with waifu2x to get the final picture.

Posted
5 hours ago, coomi said:

image.thumb.png.8256464df69e5f2f487cb3bf72d40389.png

Experimenting with AI painting over screenshots. 

  Hide contents

This is the starting point, a cropped Kuro 2 screenshot

image.thumb.jpeg.d201215b9695d74a202efd622357bc81.jpeg

I used img2img with NovelAI to make it look like artwork

image.png.8d6ada30681c72737d1dc369e620492e.png

and then removed the towels with inpainting. 

 

image.png.e1340654fbf763f85835f0b317365bf9.png

I ran img2img on this picture again to clean it up

image.png.fbf8c91c34b6d31ef71ab6a9389351a3.png

I upscaled this image with waifu2x to get the final picture.

I also tried something similar before

QQ图片20221025000710.jpg

Posted (edited)

@amorrow28

Use  Google Translate

Using your tool, I successfully imported my custom model in Game(A model of Vtuber).Now I try to use make_vgmap_from_gltf.py to translate weight better. You mentioned "Using Julian's convertor, all the body meshes are combined into one" .So where do i find “Julian's convertor”? 

Edited by fateli
Posted
2 hours ago, fateli said:

@amorrow28

Use  Google Translate

Using your tool, I successfully imported my custom model in Game(A model of Vtuber).Now I try to use make_vgmap_from_gltf.py to translate weight better. You mentioned "Using Julian's convertor, all the body meshes are combined into one" .So where do i find “Julian's convertor”? 


https://www.loverslab.com/topic/194614-kuro-no-kiseki-mod/?do=findComment&comment=3902443

 

Posted (edited)

Index of my tutorials and where to find my mod:

 

1888151403_ShizunaDemo.png.16dcd783beb190716f9b026efcd564c9.png

 

Tutorial time!

 

I wrote my skeleton code, but I am afraid that people do not know how to use it.  So here is a tutorial on using it for faster weight transfer.

 

Using this tool for a simple transfer like a nude mod will be much faster (Agnes to Renne took me 5 minutes in my original post above, although I did not join the head to the neck which would have taken a lot of time).  For this tutorial, I wanted to give my tools a workout, so I transferred Agnes' DLC bikini to Shizuna.  This was much more difficult, and I wrote a bunch of accessory scripts.  Please use this download here to grab all the tools at once:

 

Upload replaced with newer version 3/22/23.

 

Kuro VG maps.7z

 

Latest version always at my Github, of course.  And if you just want the mod itself, it's at the bottom of the tutorial.

 

Quote

 

First, set Blender, plugins and python scripts up.  I'm currently using Blender 3.3.1 LTS with the updated 3DMigoto plugin.  Basic instructions on setup at the top of this tutorial:  https://www.loverslab.com/topic/166239-trails-of-cold-steel-4-mod-request/page/13/#comment-3757792 I include two new plugins in the download above, install those as well.

 

Second, you want to know how to get a model into Blender in the first place.  Please try this tutorial here at least once, then come back:  https://www.loverslab.com/topic/166239-trails-of-cold-steel-4-mod-request/page/14/#comment-3767886.  Be sure to use my Kuro-specific merge and split tools (LL link here, but use GitHub link for latest version).  The latest version of my split tool assumes you are using the latest 3DMigoto that supports the Kuro-native DrawIndexedInstanced command (comes with UnSkirt v1.3 or newer).

 

 

Ok, let's go!

 

Step 1: Obtain the meshes, generate skeletons, name the bones.
 

Quote

 

This is a long tutorial, but if you have made it through my previous weight transfer tutorial, you can definitely do this one.  This method is much faster than the old method.

 

Download the package of scripts above, if you did not already do so.  The first time you use my scripts, be sure to install the blowfish and zstandard python modules as they are needed to decrypt the game assets.  Run "install_blowfish_and_zstandard.bat" by double-clicking it.

 

First, let's identify the actual models we need.  I used @woofhat's list, and Shizuna is chr5117.mdl.  Agnes (chr5001) has a lot of costumes, and I don't know which one is correct, however.  Here, I grabbed a bunch of candidates and put them in a folder with shizuna.  Run "kuro_mdl_to_gltf.py" in your folder with the .mdl files, and it will convert them all to gltf.

 

Spoiler

1898382541_2022-10-2321_55_23-Window.png.52dd32f3c9ef5d43fe4578a8d0d2aec0.png

 

Now you can view the models in Blender (File Menu -> Import -> glTF 2.0).  I opened all my Agnes models, and identified the one I wanted (chr5001_c56.mdl).

 

Use 3DMigoto to dump the meshes that you want.  You will want textures as well, so edit line 487 of your dxdi.ini file in the Kuro directory as following.  Then press F10 in game to reload the configuration.

 

Spoiler

2119758843_2022-10-2321_58_50-Window.png.da9496410e897fc325d1167ec7fc8e05.png

 

The easiest way to dump a costume is from the costume equip menu, which will reduce the number of objects significantly.  If you dump from the costume equip menu and then use my Kuro merge tool, the output folder will basically only have the costume files and nothing else.  Here, you can see my Agnes swimsuit folder has the model as 000025-000034, and my Shizuna folder has the model as 000013-000022. (Your numbers will be different!)
 

Spoiler

1762079409_2022-10-2321_59_20-Window.png.b0167f2d5a6b690c5d4fc42e03b86a5a.png

 

1030190186_2022-10-2321_59_25-Window.png.f0a0f7b7af7ac6b42cd110a6990cd9bf.png

 

Open the meshes (File Menu -> Import -> 3DMigoto frame dump analysis).  Save the ones you want as .fmt/.ib/.vb (File Menu -> Export -> 3DMigoto raw buffers).  To make this easy to follow, I used the index numbers, for example 000027-ib-xxxxxxxx.txt became 27.ib.  I saved Agnes in one folder, and Shizuna in another.

 

We will want to rename all the bones for both models.  Also, we need to figure out which bones (weight groups) Agnes has, that Shizuna does not have.  This is critical!  Those groups will need to be removed, or merged into another group.  (If you are lucky, there will be no missing bones.  When I tried using coomi's nude Agnes mod on Renne, for example, I skipped all of these steps because there were no missing bones.  For this mod, I was not so lucky.)

 

For the DONOR (Agnes' swimsuit), we want mesh-specific bones only.  We do not want to deal with bones that the costume does not use, for example skirt bones!  First, figure out what you meshes you will actually use.  For Agnes' costume, I only want 27, 28, 33 and 34.  I deleted all of the other files.  Merge all of meshes.

 

To do this, delete everything in Blender or start a new file (File Menu -> New -> General) and delete the default objects.  Import the meshes (File Menu -> Import -> 3DMigoto raw buffers).

 

Spoiler

194589084_2022-10-2322_02_05-Window.png.730a966af54e5e35db27c2f9e43237bf.png

 

If you just imported the meshes, one mesh will be orange and the others will be red and you can skip this step.  If this is not the case, then in the list in the upper right (the outliner window), click on the first mesh.  Then SHIFT click on the last mesh.  Now they are all selected.

 

Join all the meshes into one by pressing CTRL-J.  Export to .fmt/.ib/.vb as a new file; do NOT overwrite your other files (File Menu -> Export -> 3DMigoto raw buffers).  I saved it as agnes.vb.

 

Spoiler

1184344157_2022-10-2322_02_25-Window.png.f64a567f50ef278721aeb75ca57238fa.png

 

Copy the .gltf file that belongs to the model you are working with into the folder with the meshes, and make_vgmap_from_gltf.py.  Run make_vgmap_from_gltf.py.

 

Spoiler

1385307912_2022-10-2322_06_41-Window.png.f0d2acf2a4edb33bf412df5dba5281aa.png

 

When it asks you which skeleton to use, pick the body skeleton.  It will ask for each mesh.

 

Spoiler

1575735169_2022-10-2322_06_42-Window.png.f787265a5bcfe25601072ddb6993f4d7.png

 

For the recipient model (Shizuna), let us plan where the new costume will go.  For the best outcome, we will plan to move body mesh to body mesh, and clothes mesh to clothes mesh.  Looking at Agnes' costume, there are two textures as you can see, 04c19669 and de5aaa79.  (These are in the frame dump folder, I moved the files into its own folder so you can see what I am doing more easily.  Remember, I am porting 27, 28, 33, 34.)

 

Spoiler

1422413040_2022-10-2322_06_43-Window.png.e75e45accffd42f7f9c65405a76bd769.png

 

So we need two meshes, a clothes mesh and a body mesh.  For Shizuna, I will use 14 and 22 as recipients.  14 was an arbitrary choice, but 22 is mandatory because it has the neck.  Luckily, 22 is already using de5aaa79.  Shizuna's model has two texture maps per mesh, but this should not be an issue because we will replace the UV maps to all point to the first texture automatically because Agnes' mesh only uses one UV map.  I am also going to modify 19 because I would like to keep her hair ribbon.  I will hide the other meshes.  So I have exported 14.vb, 19.vb and 22.vb from the frame dump.

 

Spoiler

1021267811_2022-10-2322_06_45-Window.png.773c43082e61888981d90f2d4e4fe44d.png

 

In Kuro no Kiseki, every mesh has access to the whole skeleton.  So for the recipient character, you can use all the bones, even if the original costume does not use it!  I want a map of Shizuna that has EVERY bone in it, even if a mesh in her costume is not using that bone.  In your folder with your Shizuna .gltf, run make_complete_vgmap.py.

 

Spoiler

1703407163_2022-10-2322_06_46-Window.png.58215817cf9b4cae9bdafdbaa8344c4d.png

 

(make_vgmap_from_gltf.py must also be in the folder, but do NOT run that file.  It is there just so make_complete_vgmap.py can access its functions.)  It will ask which skeleton you want to use.  Choose the body skeleton.  It will also assign the complete map to every mesh in the folder.

 

Spoiler

2043347300_2022-10-2322_06_47-Window.png.db1d36bb45014508f26a33007c68819f.png

 

Here you see the new map is named "chr5117.mdl_mesh_bodyRe02.vgmap" (19.vgmap and 22.vgmap are identical).  For clarity I am going to rename "chr5117.mdl_mesh_bodyRe02.vgmap" to "shizuna.vgmap"

 

Spoiler

72247437_2022-10-2322_06_48-Window.png.8ba883ae7aa6fe7bfd010a9d239c087d.png

 

(OPTIONAL) Put the two composite vgmaps together in a folder so we can compare them.  (REMEMBER: The donor {agnes} vgmap has ONLY the bones we need, the recipient {shizuna} vgmap has ALL of her bones.)  Run compare_vgmaps.py.  It will create two new files, not_in_agnes.vgmap.json and not_in_shizuna.vgmap.json.

 

Spoiler

865605960_2022-10-2322_07_02-Window.png.78779726fea89934a23d270451b92490.png

 

 

 

 

Step 2: Deleting vertex groups that you cannot port
 

Quote

 

Now let's port the costume!

 

Open your donor meshes first, as we need to get rid of vertex groups we do not have access to.  Here I have opened 27, 28, 33 and 34 for Agnes.  The meshes should now have bone names in the vertex group window when you import them, check to make sure they do!

 

Spoiler

496705606_2022-10-2914_17_22-Window.png.cce92cc4ffd2ecf7ce2949891e5ee24e.png

 

Join your cloth meshes together (27, 28, 33).  Leave your body mesh separate.

 

Spoiler

1222543098_2022-10-2914_17_36-Window.png.df81b13117ca72ce5fd54115899190a6.png

 

Optional - rename your meshes so you know what they are.  I have named my two meshes "agnes bikini" and "agnes body."

 

To make this easier, I am now going to delete things I do not intend to keep in the final model before working with weight groups.  Here, you can see I am deleting her hair ribbon.

 

Spoiler

1577419646_2022-10-2914_21_52-Window.png.e97ee839926f7b1a01559cd540b80f73.png

 

Let's analyze the weight groups.  I will do the body first.  Select her body in object mode.

 

Go to the Vertex Groups menu.  (Object Data Properties > Vertex Groups > Vertex Group menu) and select Lock Groups using VGMap.  (If you do not have this option, you did not install the plugin included in my download package above!)  When it asks for a .vgmap file, pick the shizuna.vgmap that you generated above.

 

Spoiler

1799405588_2023-03-2220_14_03-.png.c5a2025f36b756a4c8e0b2d9f886824c.png

 

All the groups that can be ported are now locked, and only the missing groups are unlocked.  Here you can see Tai01 is not in Shizuna's model, and cannot be used.

 

Spoiler

95571689_2022-10-2914_40_13-Window.png.5a8d6b4a46017712471ca37a63850705.png

 

Hide the mesh you are not working with, and switch to weight paint mode.  Turn on X-ray mode.

 

Spoiler

631069295_2022-10-2914_42_27-Window.png.f4f418d1fea8b75f4e5a4cc8ed5b8ab7.png

 

Lucky!  Looking in weight paint mode, this group is not used anywhere.  Delete it.

 

Spoiler

912780071_2022-10-2914_43_54-Window.png.6270b9fbd6671b53ff9be7b13fec1c48.png

 

Unlock all the groups.

 

Spoiler

1495435830_2022-10-2914_44_18-Window.png.0e6da4ef2b1136040457cd5971b14a29.png

 

Go to Weights -> Normalize All.  (Just in case that group was used somewhere).  In the options in the lower left, be sure to turn OFF "Lock Active."  This mesh is now ready for merge (although we will resize first).


 

Spoiler

1869683288_2022-10-2914_44_42-Window.png.cfe56cbd6d1055862e425a39413fec7f.png

 

1919786652_2022-10-2914_44_58-Window.png.da12e0594b4821a16c067a6635a262a0.png

 

Now it is time to repeat with the other mesh.  Go to object mode, select the bikini mesh, then run lock_common_groups.py in the scripting tab and pick the same JSON file as last time.

 

This time, I am not so lucky.  There are 8 groups that do not match.

 

Spoiler

1096228271_2022-10-2914_50_33-Window.png.d78686fd48d1edf5fd40f5bb211d1411.png

 

Do you remember that we deleted the hair ribbon though?  That may take care of some vertex groups.  Run my plugin that deletes empty vertex groups (again, Object Data Properties > Vertex Groups > Vertex Group menu).

 

Spoiler

389349621_2023-03-2220_18_18-.png.097b38cdc0ff4bcdd1650ec74cbd5a25.png

 

Two of them, "L_Rib01" and "L_Rib02", are now gone.  The other six all belong to ribbons hanging off her bikini.  We will need to merge the groups into adjacent groups, and then delete.  You can do this in the same way that I did in my prior tutorial on nude porting if you like, by comparing groups.  But we do not need to compare groups when we have the skeleton!

 

Open Agnes' .gltf file.

 

Spoiler

1251707438_2022-10-2918_05_30-BlenderFileView.png.799fa6e9bcca28c2a0149e48e3346f0a.png

 

In the upper right window (outliner), you can see the model you just imported has the skeleton.  Expand out the bones until you find the groups you need.

 

Spoiler

1915460537_2022-10-2918_06_38-BlenderFileView.png.cb212f3d7dea9451ce99219dd9156b4b.png

 

Here I can see that Left and Right KosiHimo 1 and 2 are tied to Hips, and MuneRibon01 and 02 are tied to Spine 2.

 

Hide or delete the gltf model, you won't need it anymore.

 

Select the bikini mesh again, and make sure you are in object mode.  Select modifier properties.

 

Spoiler

831041995_2022-10-2918_47_35-BlenderD__untitled.blend.png.643a5a0e34b9091563db36464345991f.png

 

Click Add Modifier, and pick Vertex Weight Mix.

 

Spoiler

737155281_2022-10-2918_47_44-BlenderD__untitled.blend.png.b5989b13379932202175495a39fe72a0.png

 

Set A to be the recipient (parent bone) and B to be the group to delete (child bone).  Set Vertex Set to "VGroup A or B" (or, NOT and!) and Mix Mode to "Add."  (Note: This screen has changed in Blender 3 - if you are still using an older version of Blender, I have a screenshot of the older weight mix panel in this tutorial.)

 

Spoiler

857336576_2022-10-2918_48_59-Window.png.c4b5a7d6890baface0b07bfbb9cd5564.png

 

To save time, you can press Shift-D to duplicate for as many bones as you need to delete, and then change the groups without changing the other settings.

 

Spoiler

1238548949_2022-10-2918_56_52-Window.png.53ddaf13bc8ddd9bae2a8ae4817fe50e.png

 

Press Ctrl-A to apply each modifier, until all your weight groups have been transferred.

 

Spoiler

258199468_2022-10-2918_58_43-Window.png.f5bc247080299b1ad2579b4aa8fa9ede.png

 

Now you can check the weight groups, you can see Hip and Spine2 have the weights.  (Old on the left, new on the right)


 

Spoiler

1070102826_2022-10-2919_02_34-Blender_D__untitled.blend.png.ecedaa966e33b834c902359c6c3ed623.png

 

1480812937_2022-10-2919_02_43-Blender_D__untitled.blend.png.ea68c84415873d401c0439d9b05321f4.png

 

You can now delete those groups that you do not need.  Delete all unlocked groups, and then unlock all groups.  To be safe, you could also Normalize All.
 

Spoiler

272369206_2022-10-2919_12_03-.png.b523b027d0b696280c7eb58f724cbcce.png

 

2064786504_2022-10-2919_12_15-Blender_D__demo2.blend.png.c9effa42c4758f05607deb48ecb09e8d.png

 

 

 

Continued in the next post.

Edited by amorrow28
Posted (edited)

Step 3: Transferring meshes and exporting back to Kuro no Kiseki

 

Quote

 

This is a good time to save your meshes and see if they will work in game.  Do not skip testing!

 

First, save your work in a blend file.

 

Import Shizuna's meshes (14 is jacket and 22 is body for me.).  Notice that Agnes is shorter.  We will need to scale.

 

Spoiler

1731529173_2022-10-2919_28_36-Window.png.a26e730c3292d9100dd727f25467e873.png

 

Select both of Agnes' meshes (click one, then Ctrl-click the other).  Press S to scale, and pull Agnes' meshes up - make sure they are together!!

 

Spoiler

1051312976_2022-10-2919_28_57-Window.png.722ad1c698df713a5d2cf620673bb34c.png

 

With you two donor meshes still selected (Agnes), switch to edit mode.  Change to Face Select.  Select None (Press Alt-A).
 

Spoiler

850573505_2022-10-2919_39_36-Window.png.71105d10489732e1d0ae400165747ea1.png

 

1955286216_2022-10-2919_40_04-Blender_D__demo2.blend.png.43884e44c769de87448bb38e703b2d5e.png

 

1579565631_2022-10-2919_40_11-Blender_D__demo2.blend.png.38c2cd3d22e634c43ced795effc38459.png

 

Go back to object mode.  Select your two recipient meshes (Shizuna) and switch to edit mode.  Select Face Mode.  Select All (Press A).

 

Go back to object mode.  Now merge, one at a time.  Select donor body (Agnes), then Ctrl-click on recipient's body (Shizuna, 22.vb for me).  Agnes should be in red, Shizuna in yellow.  Press Ctrl-J to join.

 

Spoiler

1340337859_2022-10-2919_43_04-Blender_D__demo2.blend.png.23bb8c7af7e72a762e616bb71989995b.png

 

Go into Edit mode, and you should see that the two meshes are merged, but only Shizuna's polygons are selected.  Right click, and select "Delete faces."

 

Spoiler

111803165_2022-10-2919_49_39-Blender_D__demo2.blend.png.645ce39ae95cbe6beb3e10575e5c2388.png

 

Repeat for the Bikini and Shizuna's Jacket (14.vb for me).  Bikini in red, jacket in yellow.  Ctrl-J to join.  Edit mode, right click, delete faces.

 

Spoiler

420390129_2022-10-2919_50_25-Blender_D__demo2.blend.png.0371a610fe51ce89b3f690a33a39592d.png

 

Before going any further, let's push these into the game.

 

Go back to object mode, and export to fmt/ib/vb (File Menu -> Export -> 3DMigoto raw buffers).

 

Prep the mod as you normally would, based on all my past tutorials.  Use kuro_vb_split.py to split the buffers and create ini files.  For the body, since the textures are the same, you can just replace the mesh, matching on Shizuna's IB (Shizuna's body IB hash is ea3eb976).

 

For the bikini, you need new textures.  Grab t0, t3, t7 and t9 from Agnes.  Insert them into the ini file.  Use Shizuna's hash (here I am using the jacket, IB hash a0590adc).
 

Spoiler

1072287464_2022-10-2920_02_26-FrameAnalysis-2022-10-23-215141.png.478e6d99471e23e152d5a3a5b3767035.png

 

1770723845_2022-10-2920_04_42-D__Steam_steamapps_common_THELEGENDOFHEROESKURONOKISEKI_Mods_ShizunaBikini.png.bc3bee4aa92ca65feaf6b5677ec677c5.png

 

Hide the remaining parts of her costume as usual (see here).  (I hid 15 {a0590adc}, 20 {b5c08ca3} and 21 {675312ed}).  19 {a1155bf1} is the bulk of her costume but it has her hair ribbon so I actually imported it into Blender, deleted everything except the ribbon, and exported it.  See my previous tutorial on how to do this.

 

If you have done everything exactly as I have, at this point you can load Kuro and see a working mod!

 

Spoiler

169547386_2022-10-2919_56_24-TheLegendofHeroes_KuronoKiseki.png.ea5e9d99f2b48dafcfe739618adb3aad.png

 

 

 

 

Step 4: Bonding the neck to the head
 

Quote

 

Ok, to get this to be a fully useable mod, we now have to bond the neck to the head.  To do this, we need to vertices at the edge to match 100%.  Import Shizuna's head (mesh 17 for me, IB fcf092c1).

 

You might want to make the body just a little shorter than the head, so you can see the gap.  (Be sure to scale the body and the bikini together!!)

 

Spoiler

910355002_2022-10-2920_12_50-Blender_D__demo3.blend.png.4c770937340e3e6feef8fa2b38f5c737.png

 

Select the body mesh and the head mesh together, and go into Edit mode, Vertex Select.

 

Spoiler

2075012898_2022-10-2920_14_07-Blender_D__demo3.blend.png.b97c75aaae67d9aa3931edc166991ac3.png

 

Click on snapping, and then click on vertex.  Then click on the magnet to turn it on.

 

Spoiler

1589485705_2022-10-2920_14_22-Blender_D__demo3.blend.png.77b79ec40ccc864325a444c4a74563a6.png

 

Select none (Press Alt-A).  Select move.

 

Spoiler

1881641640_2022-10-2920_16_00-Blender_D__demo3.blend.png.7e970025f35f90cc26d0091eb2bfb2c2.png

 

Move the neck vertices to the head, one by one (DO NOT MOVE HEAD VERTICES TO NECK!  You are modding the body, not the head!)

 

Once you are done, you can get rid of the head (or hide it).

 

Now we need to make sure the vertex groups match.  Go back into object mode, and rename your body mesh to something you will recognize (I changed "22.vb" to "body")  Import another copy of Shizuna's body.  Open the sidebar (press N) and then move the new mesh to the side.  For all the following screenshots, the new body is on the left, and the old unchanged body is on the right.

 

Spoiler

1932904400_2022-10-2921_08_26-Blender_D__demo5.blend.png.ddab0f864dfee68f20c9be085f115212.png

 

This is the very tedious part.  We must change ALL the vertices at the neck join to have weight groups matching the original mesh.  This is the fastest way I have figured out how to do this so far, although hopefully I will one day come up with a better way.

 

Select both meshes (click on one, ctrl-click the other), and go into Edit mode, then Vertex Select.

 

If you remember from moving vertices into place, there are often many vertices at the same location.  We want to update them all at once to make this go by faster.  Also, luckily the vertices are symmetric in the X dimension so we will do both sides at once.

 

Make sure you are on the move tool.

 

Select a vertex (draw a box around it) and move it out of the way of the ones below it.  Keep doing that until you have revealed all the vertices.  Always leave at least one vertex in the correct position, so you can move the others back easily to the correct location!  (If you move the last vertex, press Ctrl-Z to undo).  Repeat on the other side.  In my screen shot, you can see I have revealed overlapping vertices on the symmetric points, but have left one in place on each side so that I can move the others back.

 

Spoiler

819234974_2022-10-2921_25_39-Blender_D__demo5.blend.png.df4ebf8b9f9b85acdb385c168ac0f62d.png

 

On the original mesh, grab the numbers for the weight influences.  You should see the correct weights under "Vertex Weights."  Copy them over to ONE vertex on the new mesh, one value at a time.  Do not just look at the number and copy it, click on it to get the precision value!  See my two screenshots - Blender rounds the number if you do not click on it.
 

Spoiler

2102373949_2022-10-2921_26_38-Blender_D__demo5.blend.png.5dbd8a240e890e8145459d8025e5fcd7.png

 

366077844_2022-10-2921_26_30-Blender_D__demo5.blend.png.e5395c91176c6cfa01613aea72a5f12c.png

 

Once you have them on one vertex of the new mesh, you can copy them to the others much more quickly.  Click on one vertex that you have not changed, then Ctrl click on the other vertices, and finally click on the one you DID change LAST so that it is active.  Press the Copy button on the vertex weight panel in the sidebar.  Now all the weights should be copied.  Repeat this for all the other vertices on the neck join.

 

Spoiler

1868959242_2022-10-2921_28_18-Blender_D__demo5.blend.png.c4a868c6bc0f365d0a5be877e7a3ad0d.png

 

If the destination vertices have the wrong groups, you can delete groups and add groups.  To delete groups from a vertex, click the X next to the weight.  To add a new group, select it from the vertex groups menu under the outliner and click assign.
 

Spoiler

457178102_2022-10-2921_40_12-Blender_D__demo5.blend.png.89a106e1cb7039612c3cefa4ee87f534.png

 

540463733_2022-10-2921_40_19-Blender_D__demo5.blend.png.a688ccba85a781cf075898c3fe659994.png

 

Once again export your body mesh, overwriting your previous version.  Split the meshes in game, and enjoy your mod!

 

 

ShizunaBikiniDemo.7z

 

Here is the finished mod, if you would like to use it.  For the final product, I changed the color of the bikini to match her hair.  See my texture tutorial here on how to recolor.  If you would like the original white color, you can grab the texture using 3DMigoto from Agnes, as above.

Edited by amorrow28
Posted (edited)

 @amorrow28

How to use alpha or transparent on other clothing?Such as Risette's swimsuit in picture. I try to make a alpha map in texture with Photoshop ,but it doesn't works.

 

1.png.27503ccf9df796434e6de16123123563.png

Edited by fateli
Posted
1 hour ago, fateli said:

 @amorrow28

How to use alpha or transparent on other clothing?Such as Risette's swimsuit in picture. I try to make a alpha map in texture with Photoshop ,but it doesn't works.

 

1.png.27503ccf9df796434e6de16123123563.png


Transparency is only available with some shaders. If the mesh uses a shader without transparency, you cannot add it with 3DMigoto.

 

If you want a transparency effect, you will need to use a costume that already has transparency on some part of the model, and replace that specific part because the shader there allows transparency.

 

Until we have model repack tools, we are limited to what is possible in 3DMigoto.

Posted

Is there a mod that replaces Feri's shorts with panties on her school uniform costume? There were screenshots like that circulating on 2ch before the PC port released so it's possible that the "uncensored" assets already exist in the game.

Posted (edited)

1234555709_2022-11-0414_01_03-TheLegendofHeroes_KuronoKiseki.png.06e7e180790db27a0978a815867fe568.png

 

To my fellow modders,

 

I have a new set of tools to unpack and repack MDL files!  You can now make mods that do not need 3DMigoto, which is hopefully good news for people playing Kuro (and future Falcom games) on modded consoles (e.g. PS4) and Steam Deck - although I do not have any of these devices so I cannot test.  You can also now change shaders and other things that remain impossible using 3DMigoto.  You will not have to worry about shared assets (for example, Nina and Odette's uniforms having shared IB hash) when making mods in this way, or two mods conflicting with each other because they share the same base model.

 

UPDATED TO v1.5.10!

 

 

KuroMDLTools_v1.5.10.zip

Many thanks to @uyjulian for his mdl parser, which I base all my work on.  This would not have been possible at all without him.  Also big thanks to the KuroTools team and DarkStarSword.  And also a special thanks for @woofhat for teaching me about G1M tools (and of course to the author of G1M tools, @vagonumero13) - I thought repacking was almost too hard until I saw the brilliant idea of partial repacking (just altering the parts of the file we understand, and copying the parts we do not).

 

As always, the latest version is on my GitHub.  Tutorials on use are here on my GitHub wiki.

 

Changelog:

Spoiler

v1.5.10

  • When kuro_mdl_import_meshes.py encounters submeshes with non-matching vertex group maps (vgmap), it will now assess for possible compatibility and, if compatible, it will rewrite the vertex group map to match the internal structure of the mesh.
  • Change the default value for complete_vgmaps_default in kuro_gltf_to_meshes.py to True.

 

v1.5.9

  • Add a simple shader hashing system, to be utilized for finding similar shaders.  A script, kuro_find_similar_shaders.py, and a database (kuro_shaders.csv) are now included in the release package; this script is used for finding shaders that are similar to the inputted shader, sorted by increasing difference in the shader switches.
  • Change the default value for complete_vgmaps_default in kuro_mdl_export_meshes.py to True.

 

v1.5.8

  • Add support for updated Blender plugin that outputs .vb0 files (needed for Blender 4.x, tested with plugin commit 5fd206c).

 

v.1.5.7

  • Fix crash when building an MDL file with non-skinned meshes

 

v1.5.6

  • No longer inserts duplicate materials if two or more meshes use the same material (required for v2 MDL).

 

v1.5.5

  • Fix crash when deleting a mesh in a Kuro 2 MDL without downgrading to Kuro 1 format.

 

v1.5.4

  • Hotfix for animation importing, which was broken in v1.5.3 resulting in the script crashing.

 

v1.5.3

  • Support for extracting and importing animations in JSON format.  Currently this is the only way to edit non-TRS animations (UV scrolling, shader parameter varying).
  • Fix crash if gltf uses transformation matrices to describe nodes instead of TRS. (kuro_gltf_to_meshes.py)
  • Fix crash for if nodes have non-orthogonal rotation matrices. (kuro_gltf_to_meshes.py and kuro_mdl_import_animation.py)
  • Fix incorrect method of asin math domain error (Quaternion->Euler). (issue introduced in v1.5.1)
  • Add pygltflib module to python install modules

 

v1.5.2

  • Materials are now imported from material_info.json into the MDL only if utilized by a mesh.
  • Merge animation script now detects animations vs costumes by _m vs _c in the name of the mdl.  It will merge animations into a costume if the base model is not available.
  • Merge animation script will now remove any animations it finds in the base model .glb before merging in the animation .glb data.  This is necessary both for Blender and for re-insertion into the game (but can be disabled by command line option).

 

v1.5.1

  • Normal / Tangent SNORM support (MDL v4 NX assets)
  • Fix crash for MDL v2 empty mesh insertion
  • Fix crash for asin math domain error (Quaternion->Euler)

 

v1.5.0

  • README updated, adding URL to Tutorial wiki.
  • Added support for animation.  Considered experimental at this time.  Only TRS animations are supported at this time.
  • Added support for skeleton modification, via glTF asset extraction.
  • Added support for glTF asset extract (meshes, skeleton, skeletal bindings)
  • glTF now properly assigns meshes to nodes.
  • Basic material support for glTF (base color texture and normal texture preview in Blender)
  • mesh_info.json now links to material_info.json by material name instead of index number.
  • Texture unknown 0 and 1 are now wrapS and wrapT
  • New image_list.json output from kuro_mdl_export_meshes.py
  • Catch and report errors for:
    • Invalid JSON (update of lib_fmtibvb from repository eArmada8/gust_stuff)
    • Missing JSON files
    • Missing python module(s)
    • Invalid vertex group mapping (improper weight transfer)
    • Missing materials in metadata.json

 

v1.3.4

  • For Kuro 1, missing submeshes are now deleted (reversion to v1.0.1 behavior).  Kuro 2 will continue have blank submeshes inserted.
  • CLE zstandard compression is now applied only if the original MDL file is compressed.

 

v1.3.3

  • Remove non-allowed characters from filenames during export/import

 

v1.3.2

  • Fix handling of COLOR during version downgrade (switch BGRA to RGBA)

 

v1.3.1

  • Fix handling of UNKNOWN (Kuro 2 fix broke Kuro 1 compatibility, this restores Kuro 1 compatibility)
  • Fix parsing of mdl_version.json

 

v1.3.0

  • Change UNKNOWN semantic to COLOR, changed interpretation from 32-bit float to R8B8G8A8_UNORM (thank you to fakecheng)
  • Add decompression tool
  • Add numpy module to python install modules

 

v1.2.2

  • Fix import failing if called from commandline without force version

 

v1.2.1

  • New JSON file with MDL version, to facilitate version downgrades

 

v1.2.0

  • New command line option to force a downgrade during repacking from Kuro 2 format to Kuro 1 format
  • No longer deletes submeshes - instead an empty submesh is inserted (for Kuro 2 support)
  • Add (partial) support for direct editing of shader values (thank you to Arc)
  • Add pyquaternion to module installer batch file
  • Fix compression algorithm to byte-align (thank you to Shingentsu, TwnKey, Renza)
  • Fix Kuro 2 texture variables (thank you to fakecheng)

 

v1.1.0

  • Adds support for Kuro no Kiseki 2
  • Importer now automatically compresses output (this can be turned off in a command-line option)
  • Exporter can be configured to output complete vgmaps by default, via global variable on line 20
  • Add compressor script (to compress accessory files, e.g. textures)

 

v1.0.1

  • No longer crashes if model file does not have a skeleton

 

v1.0.0

  • Initial release

 

Requirements:

Quote

1. Python 3.10 or newer is required for use of these scripts. It is free from the Microsoft Store, for Windows users. For Linux users, please consult your distro.
2. The blowfish and zstandard modules for python are needed. Install by typing "python3 -m pip install blowfish zstandard" in the command line / shell. (The io, re, struct, sys, os, shutil, glob, base64, json, operator, argparse and itertools modules are also required, but these are all already included in most basic python installations.)
3. The output can be imported into Blender using DarkStarSword's amazing plugin: https://github.com/eArmada8/misc_kiseki/blob/main/kuro_mdl/kuro_mdl_export_meshes.py
4. kuro_mdl_export_meshes.py is dependent on lib_fmtibvb.py, which must be in the same folder.  kuro_mdl_import_meshes.py is dependent on both kuro_mdl_export_meshes.py and lib_fmtibvb.py.

 

How to use:

 

My Blender tutorials in general

Where to find (and put) MDL files

Spoiler

MDL files go in KURO NO KISEKI\c\asset\common\model
MDL files do not have textures, the textures are in KURO NO KISEKI\c\asset\dx11\image
Please make backups before overwriting game assets.


Unpacking an MDL file

Spoiler

Put the scripts in the same folder as the mdl file that you would like to unpack.  Double click "kuro_mdl_export_meshes.py".  It will make a new folder with the same name as the mdl file, and write all the meshes in .fmt/.ib/.vb that are compatible with the blender_3dmigoto.py plugin by DarkStarSword.  Additionally, it will write .vgmap files that will map all the vertex groups to bone names.  Finally, it will write 2 JSON files, one with mesh metadata and one with material data (see below).

 

Options:
There are two major options, but you will need to use the command line.

 

Invoking the script with -c will tell the script to make .vgmaps with complete skeletons.  This will result in many empty vertex groups upon import into Blender. The default behavior is to only include vertex groups that contain at least one vertex. Complete maps are primarily useful when merging one mesh into another.

 

Invoking the script with -t will tell the script to trim the vertex buffers for use with 3DMigoto.  Meshes in the MDL contain have 15 vertex buffers (position, normal, tangent, 8x texcoord, 2x unknown, blendweights and blendindices). Only 8 of these are actually loaded into GPU memory (only the first 3 texcoords are loaded, and the 2x unknown are not loaded). This option produces smaller .vb files (with matching .fmt files) with the extraneous buffers discarded, so that upon splitting, the buffers can be used for injection with 3DMigoto.


Repacking an MDL file

Spoiler

After you have modified the .fmt/.ib/.vb files (and the JSON files if needed), double-click "kuro_mdl_import_meshes.py".  It will load the mdl file, then replace all the relevant meshes and meta data sections with the data in the exported folder.

 

There are no commandline options, but if you call it with the name of an mdl file from the command line, it will process only that file.  Otherwise it will process every file it finds that has a matching directory.

 

Deleting meshes (equivalent to hiding meshes in 3DMigoto)

Spoiler

Just delete the files for a mesh (.fmt/.ib/.vb) in the folder.  If the script does not find the file, it will remove it from the MDL. Do not edit the metadata.


Adding new meshes

Spoiler

The script only looks for mesh files that are listed in the JSON file.  If you want to add a new mesh, you will need to add metadata.  My script only reads the "material_offset" entry, everything else is automatically generated.  So a section added to the end of the "primitives" section like this will be sufficient:

            {
                "material_offset": 0,
            }


Be sure to add a comma to the } for the section prior if you are using a text editor, or better yet use a dedicated JSON editor.  I actually recommend editing JSON in a dedicated editor, because python is not forgiving if you make mistakes with the JSON structure.  (Try https://jsoneditoronline.org)  Also, be sure to point material_offset to a real section in material_info.json.  You might want to create a new section, or use an existing one.

 

Changing textures

Spoiler

First look inside mesh_info.json and find the mesh you want to edit.  Identify the group, then look inside primitives.  For example, if you want to edit the metadata for "2_woman01_body79_05.vb" then it will be inside group 2 (which is the 3rd group, 0 is the first), named "woman01_body79."  Inside "primitives" you will find mesh 5 (which is the 6th mesh, 0 is the first).  It will say "id_referenceonly": "5".  Under id_referenceonly is material_offset.  That is the material group you need to alter.

 

Go to material_info.json, and go that section.  For example, if "material_offset" in mesh_info was 7, then go to section 7 (id_referenceonly will be 7).  Under textures, you can change the file names.  When changing the texture filenames, do not put ".dds".

 

Note: All the changes should be in material_info.json.  There is nothing worth changing in mesh_info.json.

 

Note: When making mods with new textures, I highly recommend giving them unique names, instead of asking the user to overwrite textures that already exist.  That way, you do not have to worry about when two or more models use the same textures.  You should be able to add new texture slots or delete old ones as well (for example adding normal or gradient maps to meshes that did not have them before), just carefully copy from other meshes.

 

Note: The textures that come with the CLE release are encrypted.  See here for a decryption tool.


Changing shaders

Spoiler

Please see the instructions above for changing textures.  I have successfully changed a shader by copying material_name, shader_name, the entire shaders section, and the entire material_switches section from one section to the other.  I am not sure you need to copy all of these, but I have not tested enough.  Maybe it is enough to just add switches that you need (such as "SWITCH_ALPHATEST" to enable alpha) - I am just guessing.  If someone can do more testing, I would be happy to update this section.

 

Note: All the changes should be in material_info.json.  There is nothing worth changing in mesh_info.json.


Converting existing 3DMigoto mods to modified MDL files

Spoiler

3DMigoto mods are compatible with MDL files, in my limited testing.  The meshes from 3DMigoto are missing about half the mesh - MDL meshes have 15 vertex buffers, whereas 3DMigoto meshes only have 8.  However, in my testing, when you replace the MDL mesh with a 3DMigoto mesh, the game does not care about the missing data.  My theory is that the extra buffers are for use in future games, but more testing is needed.

 

To convert a 3DMigoto mod to MDL file, first find the relevant MDL file and export it with kuro_mdl_export_meshes.py.  Then open it in Blender to see which mesh you need to replace.  Then you can either 1. delete the .fmt/.ib/.vb file(s) in the export folder, and replace them with the .fmt/.ib/.vb file(s) from the mod, or 2. you can import the modded files in Blender, then export them again and overwrite the files in the mesh folder.  Then run kuro_mdl_import_meshes.py.


Converting modified MDL files to 3DMigoto mods

Spoiler

You do need to know how to make a 3DMigoto mod to do this successfully - please follow my tutorials above.  Specifically, you need to know how to find hashes and split buffers.  To convert a modified MDL file to 3DMigoto mod, first find the relevant MDL file and export it with kuro_mdl_export_meshes.py using the -t command.  This will remove the 7 unused buffers when exporting (see above).

 

From the command line, type:

python kuro_mdl_export_meshes.py -t name_of_mesh.mdl

(of course replace name_of_mesh.mdl with the name of your mdl file)

 

Find the .fmt/.ib/.vb mesh that you want, and copy that to another folder.  Split the vertex buffers and make the ini file as you normally would.  The hash data is not included in the mdl file, you will need to find it using 3DMigoto as usual.

 

Note:  This process is limited to all the limitations of using 3DMigoto.  For example, you cannot replicate shader changes, complex texture changes (such as adding new texture slots for example adding normal or gradient maps to meshes that do not already have those slots), or complex mesh changes (such as changing the semantics).

 

Note: The -t command assumes 8 vertex buffers.  If your mesh loads in memory with a different set of buffers, you must do this manually.  Split the big buffer with kuro_vb_split, and delete the vb files you do not need, then map them manually in the .ini file.  This should not be needed for costume mods, since I have not found a costume that does not use 8 buffers.  But if you want to use my tool to modify the ground in 3DMigoto, or something, be prepared to do this manually.

 

Enjoy!  As always, I am excited to see what the community does with this.  Also, please report bugs as you find them.  Both woofhat and I have tested the tools so I am fairly confident that they work, but of course I am sure new things will come up as we try them.  Also, I'd like to know if loading MDLs modified by my tool can be done with a modded PS4, etc.

Edited by amorrow28
Posted
1 hour ago, amorrow28 said:

1234555709_2022-11-0414_01_03-TheLegendofHeroes_KuronoKiseki.png.06e7e180790db27a0978a815867fe568.png

 

To my fellow modders,

 

I have a new set of tools to unpack and repack MDL files!  You can now make mods that do not need 3DMigoto, which is hopefully good news for people playing Kuro (and future Falcom games) on modded consoles (e.g. PS4) and Steam Deck - although I do not have any of these devices so I cannot test.  You can also now change shaders and other things that remain impossible using 3DMigoto.  You will not have to worry about shared assets (for example, Nina and Odette's uniforms having shared IB hash) when making mods in this way, or two mods conflicting with each other because they share the same base model.

 

KuroMDLTools_v1.7z 19.55 kB · 6 downloads

 

Many thanks to @uyjulian for his mdl parser, which I base all my work on.  This would not have been possible at all without him.  Also big thanks to the KuroTools team and DarkStarSword.  And also a special thanks for @woofhat for teaching me about G1M tools (and of course to the author of G1M tools, @vagonumero13) - I thought repacking was almost too hard until I saw the brilliant idea of partial repacking (just altering the parts of the file we understand, and copying the parts we do not).

 

Requirements:

 

How to use:

 

My Blender tutorials in general

Where to find (and put) MDL files

  Reveal hidden contents

MDL files go in KURO NO KISEKI\c\asset\common\model
MDL files do not have textures, the textures are in KURO NO KISEKI\c\asset\dx11\image
Please make backups before overwriting game assets.


Unpacking an MDL file

  Reveal hidden contents

Put the scripts in the same folder as the mdl file that you would like to unpack.  Double click "kuro_mdl_export_meshes.py".  It will make a new folder with the same name as the mdl file, and write all the meshes in .fmt/.ib/.vb that are compatible with the blender_3dmigoto.py plugin by DarkStarSword.  Additionally, it will write .vgmap files that will map all the vertex groups to bone names.  Finally, it will write 2 JSON files, one with mesh metadata and one with material data (see below).

 

Options:
There are two major options, but you will need to use the command line.

 

Invoking the script with -c will tell the script to make .vgmaps with complete skeletons.  This will result in many empty vertex groups upon import into Blender. The default behavior is to only include vertex groups that contain at least one vertex. Complete maps are primarily useful when merging one mesh into another.

 

Invoking the script with -t will tell the script to trim the vertex buffers for use with 3DMigoto.  Meshes in the MDL contain have 15 vertex buffers (position, normal, tangent, 8x texcoord, 2x unknown, blendweights and blendindices). Only 8 of these are actually loaded into GPU memory (only the first 3 texcoords are loaded, and the 2x unknown are not loaded). This option produces smaller .vb files (with matching .fmt files) with the extraneous buffers discarded, so that upon splitting, the buffers can be used for injection with 3DMigoto.


Repacking an MDL file

  Reveal hidden contents

After you have modified the .fmt/.ib/.vb files (and the JSON files if needed), double-click "kuro_mdl_import_meshes.py".  It will load the mdl file, then replace all the relevant meshes and meta data sections with the data in the exported folder.

 

There are no commandline options, but if you call it with the name of an mdl file from the command line, it will process only that file.  Otherwise it will process every file it finds that has a matching directory.

 

Deleting meshes (equivalent to hiding meshes in 3DMigoto)

  Reveal hidden contents

Just delete the files for a mesh (.fmt/.ib/.vb) in the folder.  If the script does not find the file, it will remove it from the MDL.


Adding new meshes

  Reveal hidden contents

The script only looks for mesh files that are listed in the JSON file.  If you want to add a new mesh, you will need to add metadata.  My script only reads the "material_offset" entry, everything else is automatically generated.  So a section added to the end of the "primitives" section like this will be sufficient:

            {
                "material_offset": 0,
            }


Be sure to add a comma to the } for the section prior if you are using a text editor, or better yet use a dedicated JSON editor.  I actually recommend editing JSON in a dedicated editor, because python is not forgiving if you make mistakes with the JSON structure.  (Try https://jsoneditoronline.org)  Also, be sure to point material_offset to a real section in material_info.json.  You might want to create a new section, or use an existing one.

 

Changing textures

  Reveal hidden contents

First look inside mesh_info.json and find the mesh you want to edit.  Identify the group, then look inside primitives.  For example, if you want to edit the metadata for "2_woman01_body79_05.vb" then it will be inside group 2 (which is the 3rd group, 0 is the first), named "woman01_body79."  Inside "primitives" you will find group 5 (which is the 6th group, 0 is the first).  It will say "id_referenceonly": "5".  Under id_referenceonly is material_offset.  That is the material group you need to alter.

 

Go to material_info.json, and go that section.  For example, if "material_offset" in mesh_info was 7, then go to section 7 (id_referenceonly will be 7).  Under textures, you can change the file names.  When changing the texture filenames, do not put ".dds".

 

Note: All the changes should be in material_info.json.  There is nothing worth changing in mesh_info.json.

 

Note: When making mods with new textures, I highly recommend giving them unique names, instead of asking the user to overwrite textures that already exist.  That way, you do not have to worry about when two or more models use the same textures.  You should be able to add new texture slots or delete old ones as well (for example adding normal or gradient maps to meshes that did not have them before), just carefully copy from other meshes.

 

Note: The textures that come with the CLE release are encrypted.  See here for a decryption tool.


Changing shaders

  Reveal hidden contents

Please see the instructions above for changing textures.  I have successfully changed a shader by copying material_name, shader_name, the entire shaders section, and the entire material_switches section from one section to the other.  I am not sure you need to copy all of these, but I have not tested enough.  Maybe it is enough to just add switches that you need (such as "SWITCH_ALPHATEST" to enable alpha) - I am just guessing.  If someone can do more testing, I would be happy to update this section.

 

Note: All the changes should be in material_info.json.  There is nothing worth changing in mesh_info.json.


Converting existing 3DMigoto mods to modified MDL files

  Reveal hidden contents

3DMigoto mods are compatible with MDL files, in my limited testing.  The meshes from 3DMigoto are missing about half the mesh - MDL meshes have 15 vertex buffers, whereas 3DMigoto meshes only have 8.  However, in my testing, when you replace the MDL mesh with a 3DMigoto mesh, the game does not care about the missing data.  My theory is that the extra buffers are for use in future games, but more testing is needed.

 

To convert a 3DMigoto mod to MDL file, first find the relevant MDL file and export it with kuro_mdl_export_meshes.py.  Then open it in Blender to see which mesh you need to replace.  Then you can either 1. delete the .fmt/.ib/.vb file(s) in the export folder, and replace them with the .fmt/.ib/.vb file(s) from the mod, or 2. you can import the modded files in Blender, then export them again and overwrite the files in the mesh folder.  Then run kuro_mdl_import_meshes.py.


Converting modified MDL files to 3DMigoto mods

  Reveal hidden contents

You do need to know how to make a 3DMigoto mod to do this successfully - please follow my tutorials above.  Specifically, you need to know how to find hashes and split buffers.  To convert a modified MDL file to 3DMigoto mod, first find the relevant MDL file and export it with kuro_mdl_export_meshes.py using the -t command.  This will remove the 7 unused buffers when exporting (see above).

 

From the command line, type:

python kuro_mdl_export_meshes.py -t name_of_mesh.mdl

(of course replace name_of_mesh.mdl with the name of your mdl file)

 

Find the .fmt/.ib/.vb mesh that you want, and copy that to another folder.  Split the vertex buffers and make the ini file as you normally would.  The hash data is not included in the mdl file, you will need to find it using 3DMigoto as usual.

 

Note:  This process is limited to all the limitations of using 3DMigoto.  For example, you cannot replicate shader changes, complex texture changes (such as adding new texture slots for example adding normal or gradient maps to meshes that do not already have those slots), or complex mesh changes (such as changing the semantics).

 

Note: The -t command assumes 8 vertex buffers.  If your mesh loads in memory with a different set of buffers, you must do this manually.  Split the big buffer with kuro_vb_split, and delete the vb files you do not need, then map them manually in the .ini file.  This should not be needed for costume mods, since I have not found a costume that does not use 8 buffers.  But if you want to use my tool to modify the ground in 3DMigoto, or something, be prepared to do this manually.

 

Enjoy!  As always, I am excited to see what the community does with this.  Also, please report bugs as you find them.  Both woofhat and I have tested the tools so I am fairly confident that they work, but of course I am sure new things will come up as we try them.  Also, I'd like to know if loading MDLs modified by my tool can be done with a modded PS4, etc.

 

So 3DM is no longer needed? We can make stuff like custom outfits now?

Posted
5 minutes ago, SonicMan1234 said:

 

So 3DM is no longer needed? We can make stuff like custom outfits now?


Yes and yes. ?

 

I doubt 3DMigoto is going anywhere for most players though, since we have so many great mods made with it. I have plans (for now) to convert unskirt mod as time allows, but I do not know if others will do the same. Still, anyone willing to learn can convert mods for themselves (or to share, with permission from the original mod maker).

 

I still plan to use 3DMigoto personally, though. I love being able to turn mods on and off, and cool features like @lakovic’s mod utilizing hot keys to change costumes are only possible with 3DMigoto. BUT… when someone makes amazing mods that are only possible with repacking, of course I will have to try them! ?

 

(BTW you can use multiple costumes of course without 3DMigoto - just inject into different costume slots.)

Posted
55 minutes ago, SonicMan1234 said:

Neat! 3DM is still plenty useful now, but when Kuro 2 comes out the new method is probably going to be the way to go.


I’m excited to see what people make! ?

Posted
On 10/21/2022 at 2:55 PM, amorrow28 said:

model_tool.png.b072b3f1d240fadcc2cd1ad94982eb1f.png

 

To my fellow modders,

 

I have written a new tool to make vertex group maps that allows for mesh binding to the skeleton!  (As always, latest version will always be at my GitHub).

 

Upload updated - original filename was misspelled.

 

make_vgmap_from_gltf.py 8.13 kB · 22 downloads

 

How is this useful?  I can think of two things.

  1. Weight painting is achievable now.  You can adjust the paint, and then move the skeleton to see how the model deforms without loading it in the game.  You can (probably?) even run the animations to see if your model looks good!  (I have not tried this.  I am not good at painting.)
  2. Weight transfer is 99.9% easier now!  My tool maps all the weight groups to their proper bones, the names of which are shared across characters.  So now instead of the upper leg being a random number, it will always be "LeftLeg" - which means all the meshes are ALREADY RENAMED when you load them!  Just merge one mesh into the other, and you are done!!

A million thanks to @uyjulian; I dissected his model dumper and figured out how to do this (here is my version).  I know Kuro modding has already cooled down, but I figure this will still be useful because Falcom will likely use this engine for many years.  Also, I think I can adapt this code to the phyreEngine games (Cold Steel series).

 

Here is a tutorial I wrote to use this for weight transfer.

 

As a test, I took @coomi's Agnes towel nude mod, and ported it to Renne (just like my tutorial).  It took less than 5 minutes, and looks so much better than automatic weight transfer.  I suspect you can do other transfers, like Shizuna's jacket onto other characters, but I have not tried.

 

  Hide contents

1498650195_2022-10-2023_07_12-TheLegendofHeroes_KuronoKiseki.png.3aa87e9d85b125cfa825d760bbc4fdf6.png

 

How to use:

 

 

Enjoy!  I look forward to seeing what you do with this and trying out your mods!

Who knows how long my network has been blocked, so I have been unable to access foreign networks. Thank God I finally came here. This is the best tool for mod producers. It will be very helpful to make kuro-no-kiseki-2 later. Thank you for your contribution to the community

Posted
6 hours ago, amorrow28 said:

1234555709_2022-11-0414_01_03-TheLegendofHeroes_KuronoKiseki.png.06e7e180790db27a0978a815867fe568.png

 

To my fellow modders,

 

I have a new set of tools to unpack and repack MDL files!  You can now make mods that do not need 3DMigoto, which is hopefully good news for people playing Kuro (and future Falcom games) on modded consoles (e.g. PS4) and Steam Deck - although I do not have any of these devices so I cannot test.  You can also now change shaders and other things that remain impossible using 3DMigoto.  You will not have to worry about shared assets (for example, Nina and Odette's uniforms having shared IB hash) when making mods in this way, or two mods conflicting with each other because they share the same base model.

 

KuroMDLTools_v1.7z 19.55 kB · 12 downloads

 

Many thanks to @uyjulian for his mdl parser, which I base all my work on.  This would not have been possible at all without him.  Also big thanks to the KuroTools team and DarkStarSword.  And also a special thanks for @woofhat for teaching me about G1M tools (and of course to the author of G1M tools, @vagonumero13) - I thought repacking was almost too hard until I saw the brilliant idea of partial repacking (just altering the parts of the file we understand, and copying the parts we do not).

 

Requirements:

 

How to use:

 

My Blender tutorials in general

Where to find (and put) MDL files

  Reveal hidden contents

MDL files go in KURO NO KISEKI\c\asset\common\model
MDL files do not have textures, the textures are in KURO NO KISEKI\c\asset\dx11\image
Please make backups before overwriting game assets.


Unpacking an MDL file

  Reveal hidden contents

Put the scripts in the same folder as the mdl file that you would like to unpack.  Double click "kuro_mdl_export_meshes.py".  It will make a new folder with the same name as the mdl file, and write all the meshes in .fmt/.ib/.vb that are compatible with the blender_3dmigoto.py plugin by DarkStarSword.  Additionally, it will write .vgmap files that will map all the vertex groups to bone names.  Finally, it will write 2 JSON files, one with mesh metadata and one with material data (see below).

 

Options:
There are two major options, but you will need to use the command line.

 

Invoking the script with -c will tell the script to make .vgmaps with complete skeletons.  This will result in many empty vertex groups upon import into Blender. The default behavior is to only include vertex groups that contain at least one vertex. Complete maps are primarily useful when merging one mesh into another.

 

Invoking the script with -t will tell the script to trim the vertex buffers for use with 3DMigoto.  Meshes in the MDL contain have 15 vertex buffers (position, normal, tangent, 8x texcoord, 2x unknown, blendweights and blendindices). Only 8 of these are actually loaded into GPU memory (only the first 3 texcoords are loaded, and the 2x unknown are not loaded). This option produces smaller .vb files (with matching .fmt files) with the extraneous buffers discarded, so that upon splitting, the buffers can be used for injection with 3DMigoto.


Repacking an MDL file

  Reveal hidden contents

After you have modified the .fmt/.ib/.vb files (and the JSON files if needed), double-click "kuro_mdl_import_meshes.py".  It will load the mdl file, then replace all the relevant meshes and meta data sections with the data in the exported folder.

 

There are no commandline options, but if you call it with the name of an mdl file from the command line, it will process only that file.  Otherwise it will process every file it finds that has a matching directory.

 

Deleting meshes (equivalent to hiding meshes in 3DMigoto)

  Reveal hidden contents

Just delete the files for a mesh (.fmt/.ib/.vb) in the folder.  If the script does not find the file, it will remove it from the MDL.


Adding new meshes

  Reveal hidden contents

The script only looks for mesh files that are listed in the JSON file.  If you want to add a new mesh, you will need to add metadata.  My script only reads the "material_offset" entry, everything else is automatically generated.  So a section added to the end of the "primitives" section like this will be sufficient:

            {
                "material_offset": 0,
            }


Be sure to add a comma to the } for the section prior if you are using a text editor, or better yet use a dedicated JSON editor.  I actually recommend editing JSON in a dedicated editor, because python is not forgiving if you make mistakes with the JSON structure.  (Try https://jsoneditoronline.org)  Also, be sure to point material_offset to a real section in material_info.json.  You might want to create a new section, or use an existing one.

 

Changing textures

  Reveal hidden contents

First look inside mesh_info.json and find the mesh you want to edit.  Identify the group, then look inside primitives.  For example, if you want to edit the metadata for "2_woman01_body79_05.vb" then it will be inside group 2 (which is the 3rd group, 0 is the first), named "woman01_body79."  Inside "primitives" you will find group 5 (which is the 6th group, 0 is the first).  It will say "id_referenceonly": "5".  Under id_referenceonly is material_offset.  That is the material group you need to alter.

 

Go to material_info.json, and go that section.  For example, if "material_offset" in mesh_info was 7, then go to section 7 (id_referenceonly will be 7).  Under textures, you can change the file names.  When changing the texture filenames, do not put ".dds".

 

Note: All the changes should be in material_info.json.  There is nothing worth changing in mesh_info.json.

 

Note: When making mods with new textures, I highly recommend giving them unique names, instead of asking the user to overwrite textures that already exist.  That way, you do not have to worry about when two or more models use the same textures.  You should be able to add new texture slots or delete old ones as well (for example adding normal or gradient maps to meshes that did not have them before), just carefully copy from other meshes.

 

Note: The textures that come with the CLE release are encrypted.  See here for a decryption tool.


Changing shaders

  Reveal hidden contents

Please see the instructions above for changing textures.  I have successfully changed a shader by copying material_name, shader_name, the entire shaders section, and the entire material_switches section from one section to the other.  I am not sure you need to copy all of these, but I have not tested enough.  Maybe it is enough to just add switches that you need (such as "SWITCH_ALPHATEST" to enable alpha) - I am just guessing.  If someone can do more testing, I would be happy to update this section.

 

Note: All the changes should be in material_info.json.  There is nothing worth changing in mesh_info.json.


Converting existing 3DMigoto mods to modified MDL files

  Reveal hidden contents

3DMigoto mods are compatible with MDL files, in my limited testing.  The meshes from 3DMigoto are missing about half the mesh - MDL meshes have 15 vertex buffers, whereas 3DMigoto meshes only have 8.  However, in my testing, when you replace the MDL mesh with a 3DMigoto mesh, the game does not care about the missing data.  My theory is that the extra buffers are for use in future games, but more testing is needed.

 

To convert a 3DMigoto mod to MDL file, first find the relevant MDL file and export it with kuro_mdl_export_meshes.py.  Then open it in Blender to see which mesh you need to replace.  Then you can either 1. delete the .fmt/.ib/.vb file(s) in the export folder, and replace them with the .fmt/.ib/.vb file(s) from the mod, or 2. you can import the modded files in Blender, then export them again and overwrite the files in the mesh folder.  Then run kuro_mdl_import_meshes.py.


Converting modified MDL files to 3DMigoto mods

  Reveal hidden contents

You do need to know how to make a 3DMigoto mod to do this successfully - please follow my tutorials above.  Specifically, you need to know how to find hashes and split buffers.  To convert a modified MDL file to 3DMigoto mod, first find the relevant MDL file and export it with kuro_mdl_export_meshes.py using the -t command.  This will remove the 7 unused buffers when exporting (see above).

 

From the command line, type:

python kuro_mdl_export_meshes.py -t name_of_mesh.mdl

(of course replace name_of_mesh.mdl with the name of your mdl file)

 

Find the .fmt/.ib/.vb mesh that you want, and copy that to another folder.  Split the vertex buffers and make the ini file as you normally would.  The hash data is not included in the mdl file, you will need to find it using 3DMigoto as usual.

 

Note:  This process is limited to all the limitations of using 3DMigoto.  For example, you cannot replicate shader changes, complex texture changes (such as adding new texture slots for example adding normal or gradient maps to meshes that do not already have those slots), or complex mesh changes (such as changing the semantics).

 

Note: The -t command assumes 8 vertex buffers.  If your mesh loads in memory with a different set of buffers, you must do this manually.  Split the big buffer with kuro_vb_split, and delete the vb files you do not need, then map them manually in the .ini file.  This should not be needed for costume mods, since I have not found a costume that does not use 8 buffers.  But if you want to use my tool to modify the ground in 3DMigoto, or something, be prepared to do this manually.

 

Enjoy!  As always, I am excited to see what the community does with this.  Also, please report bugs as you find them.  Both woofhat and I have tested the tools so I am fairly confident that they work, but of course I am sure new things will come up as we try them.  Also, I'd like to know if loading MDLs modified by my tool can be done with a modded PS4, etc.

You are, the real worker, aroused my new creative enthusiasm.

Posted (edited)

1734447912_2022-11-0420_31_58-TheLegendofHeroes_KuronoKiseki.png.b6d1b4882e3f1ae5774861c642a33833.png

 

I thought I would start us off by making a mod, hopefully to keep everyone inspired!

 

Shizuna_bikini_and_jacket.7z

 

This time, because I was using the repack tool, I could insert the bikini mesh into the mesh for gloves instead of the mesh for the jacket.  The mesh for gloves usually makes the bikini too shiny, but I changed the shader to the exact shader that is in Agnes' model, so the bikini looks perfect.  Then I could keep the jacket!

 

To use this mod - put the contents of the archive into your Kuro folder.  Be warned, it will overwrite your Shizuna model!  Please back up chr5117.mdl before installing.  (If you forget and accidentally overwrite your model, you can restore your files by right-clicking the game in Steam, go to Properties -> Local Files -> Verify Integrity of Game Files)

 

PS - If anyone tries using this on a PS4, PS5 or Steam Deck, I would love to know if it works!

Edited by amorrow28
Posted

Hello, maybe someone can provide some assistance or do a favor for me? I'm just trying to get Rixia's model into blender with her textures so I can have a friend port her model into another game. Right now I think I have it in blender correctly after exporting the model using the new py scripts. I did grab her dds texture files from the dx11 folder as well, is there a reason why the model shows up texture less inside blender? I would really appreciate it if someone could just upload a .blend that has it all setup too if anything.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...