Jump to content

Trails of Cold Steel 4 (Mod Request)


Recommended Posts

Posted
On 2/25/2023 at 2:42 PM, amorrow28 said:

juna_cs4.png.55935868a6e9f2f230e492e35ccc2ef7.png

(Huh... I thought we decided that shirt was not moddable...)

 

To my fellow modders,

 

I have written a tool chain to simplify making .pkg mods!  You can now make mods that do not need 3dmigoto, and I hope this can lead to mods we could not easily do before.  I owe lots of thanks to the folks over at the modding discord, who helped me with sample files and troubleshooting.

 

Upload replaced with v2.2.0!

 

ED8ModTools_v2.2.0.zip 56.55 kB · 31 downloads

 

Changelog:

  Reveal hidden contents

v2.2.0

  • The 'images' section has been removed from metadata.json.  The build script will now construct it from the images in 'materials'.
  • Cubemap support has been removed, as it was dependent on 'images' and there is no clear timeline for adding map support.  If reimplemented, it will be done differently.
  • The write_pkg script now parses asset_D3D11.xml if available, and will only include files listed in the xml (and the xml file itself).

 

v2.1.8

  • Fix crash with glTF extractor (bug in node suffix detection).

 

v2.1.7

  • Adds support for decompile of recompiled packages.
  • Added '_node' to new nodes to get around a strange bug in the compiler.
  • Fixed all geom regression (This bugfix was included in v2.1.4 but somehow disappeared).
  • Fix asset_D3D11.xml generation when the xml is from a template instead of the original package.

 

v2.1.6

  • Preserve the original heirarchy matrices (inverted bind matrices) where possible, instead of calculating them.  This is necessary because some matrices from Falcom do not match their node matrices.
  • Preliminary support for multi-dae pkgs and switchless shaders.  Also shader switches are now preserved in the dae (this results in zero change in the final pkg since the shaders are replaced with genuine shaders, but is necessary to manage switchless shaders).

 

v2.1.5

  • Multiple UV/TEXCOORD elements are now supported.  The ed8pkg2gltf.py script will now use the stream binding data to generate .uvmap files that are used to map textures to secondary uv's.  (The build script cannot map secondary uv's without these .uvmap files, so re-extract meshes to get the .uvmap files as needed for ongoing projects; back up all work first.)  Note: ed8pkg2gltf.py also removes all unmapped uv maps from the gltf (they are still present in the raw buffers), and extract_from_gltf will expect all unmapped uv maps to have been removed when it generates .uvmap files.  I had to implement gltf extract this way because the extractor does not have access to the stream binding data (there is no way to store it in the gltf itself).  For glTFs generated with versions before 2.1.5, delete unused uv's before extraction.
  • Bug fix - increase limit on texcoord from 3 to 8, as the secondary uv is often stored in the 4th texcoord.
  • Bug fix - prevent crash if non-skeletal nodes are in the vgmap (artifact of FBX->glTF conversion)

 

v2.1.4

  • LZ4 compression is now applied by default, resulting in ~50% reduction in .pkg size.  Tested in NISA CS3, CS4 and CLE Hajimari.  Requires lz4 python module to be installed, please run install_python_modules.bat again to install the new module.
  • Remove rounding on values for geometry and skeletal weight (bug fix).  This was present to mimic Maya output (when I was first trying to get the compiler to accept my dae without crashing), but is not needed so there is no reason not to use full precision.
  • Small bugfix for non-skinned meshes / non-character models.  Compiler will not accept more than one instance_geometry per node so now each is placed in a separate node.  Behavior for instance_controller is unchanged.
  • Updated README to call attention to using BC7 compression for textures or textures may be horizontally flipped in-game.

 

v2.1.3

  • Many bugfixes to glTF extraction
  • Add tangent calculator to glTF extractor for meshes without tangent
  • glTF produces partial vgmaps with non-empty groups only by default, as fbx export can result in non-node vertex groups (and these are retained going through conversion, but will cause the collada build to fail).  Override with command line.
  • ed8pkg2gltf.py no longer exports more than 3 uv/tangent/binormal semantics per mesh by default.  Override with command line.
  • build_collada.py now supports out-of-order node lists, TRS-transformation nodes
  • Bugfixes to build_collada.py, especially for skeleton math
  • Prevent import of top nodes without children.  These are inserted by noesis during glTF export, causes the compiler to fail, and are unnecessary as the collada builder can create the nodes as needed in the correct location.
  • Allow arbitrary mesh filenames
  • Preliminary support for non-skinned meshes and non-character models (untested)
  • RunMe.bat does not delete temporary shader files until the end of the build process

 

v2.1.2

  • Fix location of .dae file for non-base costumes (e.g. C_CHR001_C00)
  • build_collada.py now writes an updated asset_D3D11.xml file in the build directory
  • ed8pkg2gltf.py now writes TANGENT into the gltf regardless of expanded handedness (needed for extraction tool)

 

v2.1.1

  • Add handling for the COLOR semantic to ed8pkg2gltf.py and build_collada.py
  • Add experimental glTF to raw buffer extraction tool
  • Update lib_fmtibvb.py

 

v2.1.0

  • Overhaul of the materials section of the metadata.json
  • The mesh .material files also no longer say "Skinned" (unneeded)

 

v2.0.1

  • Fix collada build failure when mesh name has underscores in it

 

v2.0.0

  • This is now a modding tool chain for CS3/CS4/Hajimari (although the prior functionality still exists). Can build COLLADA .dae files and generates all necessary files to build a new .pkg for insertion into the game. Please see README.md for more details.

 

v1.0.1

  • QOL improvements (textures go in a folder now, status messages during processing, double-click to run

 

v1.0.0

  • Initial release

 

NOTE: The new v2.1.0 metadata format and .material files are not compatible with versions prior to v2.1.0. Please back up your work, compile and build your .pkg using the version you started with, and unpack with this new version to get new metadata.

 

As always, the latest version is at my GitHub.

 

Features:

  • Easy mesh editing using the familiar 3dmigoto plugin, so you can still follow all my tutorials
  • You can change textures, materials and shaders.  If you want to add a shader with transparency to a character who does not have one, you can do that!
  • You can use all the bones!  (Although you do not want to go over 80 bones on one mesh or GPU skinning will be disabled for that mesh.)
  • The resulting mod does not need 3dmigoto.  Great for users of Steam Deck, or anyone who loves steam overlay / steam input.

The phyre engine format is a nightmare, and its container files cannot be edited directly due to excessive use of pointers.  So making .pkg mods will require use of a compiler, which means the results will not be identical to original, but so far it is hard to tell if there is any difference.

 

How to use:

 

 

Enjoy!  I look forward to seeing what the community does with this!

 

@amorrow28Hello,

I found out that Angelica's pkg cannot be repackaged when using your tool. After I run build_collada.py, RunMe.bat is not automatically generated. Is this a bug?

 

 

After unpacking chr_019, I simply modified the meshes and did not make other modifications. I tried to extract the pkg from CS3 and CS4 but failed. At present, only the character Agnelica has problems, and other characters do not.

 

chr_019 for CS3 initial:C_CHR019.pkg

 

Posted
3 hours ago, lakovic said:

@amorrow28Hello,

I found out that Angelica's pkg cannot be repackaged when using your tool. After I run build_collada.py, RunMe.bat is not automatically generated. Is this a bug?

 

 

After unpacking chr_019, I simply modified the meshes and did not make other modifications. I tried to extract the pkg from CS3 and CS4 but failed. At present, only the character Agnelica has problems, and other characters do not.

 

chr_019 for CS3 initial:C_CHR019.pkg

 


This is a problem with the skeleton itself, see here for how to fix it. Edel has the same problem.

Posted
On 3/18/2023 at 9:18 AM, amorrow28 said:


 

Yeah, that is not a bug in the decompiler, Angelica's skeleton is broken. L ArmPoint and R ArmPoint have matrices of [0,0,0,0][0,0,0,0][0,0,0,0][x,y,z,1] which is totally invalid.  Correct is [1,0,0,0][0,1,0,0][0,0,1,0][x,y,z,1]. Go into the heirarchy section and fine those two nodes, and change the 1st, 6th and 11th values from 0.0 to 1.0 and the model will build correctly.

 

Btw I have no idea how this could possibly happen if using software. I have to think Falcom coded those values by hand. ?

I'm sorry I still don't quite understand, where do I go to modify these values, is it some txt file?

Posted
5 hours ago, lakovic said:

I'm sorry I still don't quite understand, where do I go to modify these values, is it some txt file?

Look in metadata.json. There is a “hierarchy” section/key. Under that, you should find the LArmPoint and RArmPoint keys, which should each  list a matrix with 12 zeros.

 

I am not looking at it right now, but it probably looks like

Spoiler

[

0,

0,

0,

0,

0,

0,

0,

0,

0,

0,

0,

0,

x,

y,

z,

1

],

It should probably instead be

Spoiler

[

1,

0,

0,

0,

0,

1,

0,

0,

0,

0,

1,

0,

x,

y,

z,

1

],

 

Posted
13 hours ago, amorrow28 said:


This is a problem with the skeleton itself, see here for how to fix it. Edel has the same problem.

I noticed a similar problem with Ada. Some matrix is singular that should not be, but I have had trouble figuring out which matrix.

Posted
19 minutes ago, NotAZebra said:

I noticed a similar problem with Ada. Some matrix is singular that should not be, but I have had trouble figuring out which matrix.


what is the pkg name? I’ll take a look.

Posted

I modified the metadata.json and re-run build_collada.py - RunMe.bat, but after entering the game, I lost part of the body, and other characters were also affected. When I deleted C_CHR019.pkg, everything returned to normal .

Spoiler

Snipaste_2023-07-17_17-41-53.png.bfe10200707ed135bbccf6e624b58cb6.pngSnipaste_2023-07-17_17-40-16.png.27e27a2b553c445c63b43a4e4dbbee29.png

Here's something I can't figure out, I just modified Angelica's pkg, why would it affect other girls?
I just did some mesh additions and the final packaged PKG lost a lot of the body

Posted
16 hours ago, lakovic said:

I modified the metadata.json and re-run build_collada.py - RunMe.bat, but after entering the game, I lost part of the body, and other characters were also affected. When I deleted C_CHR019.pkg, everything returned to normal .

  Reveal hidden contents

Snipaste_2023-07-17_17-41-53.png.bfe10200707ed135bbccf6e624b58cb6.pngSnipaste_2023-07-17_17-40-16.png.27e27a2b553c445c63b43a4e4dbbee29.png

Here's something I can't figure out, I just modified Angelica's pkg, why would it affect other girls?
I just did some mesh additions and the final packaged PKG lost a lot of the body

Does that happen if you just decompile, change that matrix, and then recompile (without adding meshes)?

Posted
24 minutes ago, NotAZebra said:

Does that happen if you just decompile, change that matrix, and then recompile (without adding meshes)?

If you just modify the metadata.json without making any other modifications, repackage and run runme.bat, Angelica will become transparent. At the same time the girl in my screenshot is also missing part of her body, skirt and chest

Posted
7 hours ago, lakovic said:

@amorrow28, hi, 这次我尝试这用中文而不使用翻译机器,因为我觉得我这边机器的翻译并不准确,我想让你那边直接用翻译,看能不能看懂我这边的意思

 

我尝试着使用您的pkg工具集,并结合3dmigoto,尝试做出两者结合的mod,pkg的优势在于能创建原本没有的骨骼(比如某些丢失的身体),而3dmigoto的优势在于mod的随时切换,这个功能一直很cool。

 

所以我按照你的教程,解包pkg,实际上我做的改动非常少,我仅仅是把身体部位的网格,通过衣服网格使其合并,进而得到一个完整的身体网格。然后重新打包。

 

比如,这里是millium的解包-网格,我们可以看到03是millium的身体网格,上半身还算完整,下半身缺少了腿部模型,

  Hide contents

Snipaste_2023-07-19_13-39-13.png.8673754074de3efa153cd51cfb265db6.png

 

所以我的想法是将衣服上的网格作为身体部分去合并,(贴图部分不管,重要的是可以让3dmigoto抓取到缺少的腿部网格,从而使用3dmigoto来进行制作mod)。

 

我将腿部模型复制出来,包含腿部的模型共有2个,分别是polySurface3955_00.vb,polySurface3955_01.vb,我将他们复制出来合并在一起,删除多余的网格,比如上半身的衣服,以及腰部的挎包,

  Reveal hidden contents

Snipaste_2023-07-19_14-03-13.png.a3b848e951ec4801da2f636d3cc2f422.png

 

最后和身体网格合并,并保持命名polySurface3955_03.vb

  Reveal hidden contents

Snipaste_2023-07-19_13-46-57.png.7750ae850a9d067b8d1e226f7c909d00.png

 

导出得到fmt,ib,vb,vgmap,将其替换掉原来的文件,并重新运行build_collada.py,RunMe.bat,当我把pkg放入游戏中,并使用3dmigoto的F12模式,我可以清楚看到的,我得到一个完整的身体(虽然腿部的纹理错误,但是这并不影响,因为可以用3dmigoto来更换纹理)

  Reveal hidden contents

Snipaste_2023-07-19_13-52-08.png.e843f31256a361a93f7f5358c1e65aa3.png

 

 

但是问题来了,我使用这个方法,对millium的无帽子模型,可以得到完整的身体,而有帽子的模型,同样的方法,不管我怎么尝试都是失败。这是为什么呢,好多问题感觉超出我的理解范围,我需要你的帮助,谢谢。(millium的无帽子代码是C_CHR009_C00.pkg,有帽子代码是C_CHR009_C01.pkg,我尝试将C_CHR009_C00.pkg复制并重新命名为C_CHR009_C01.pkg,放入data\asset\D3D11里面,通过3dmigoto发现依旧不是完整的身体)

 

对了,我还需要补充一下,以上所有操作都是在CLE版本的CS3中完成的,(如果CS3实现成功,那么CS4,Hajimari也都可以实现更多的裸体,通过3dmigoto的方法)实际上,我已经完成了很多个角色的pkg重新打包,比如穿着校服的Juna,Musse,Altina,在这以前3dmigoto是无法实现全身裸体的,但是现在借助PKG可以得到完整的身体信息了


The most likely reason is that the model pkg name is incorrect, it is probably not C01. Try changing something drastic like deleting the legs in the model with the hat and seeing what happens.

 

Renaming C00 to C01 should cause the game to crash if you pick the C01 costume in the game. If it does not crash, you are not picking C01. (If you want to swap two models, you must change the package name in the metadata or use my asset injection tools.)

Posted
44 minutes ago, amorrow28 said:


The most likely reason is that the model pkg name is incorrect, it is probably not C01. Try changing something drastic like deleting the legs in the model with the hat and seeing what happens.

 

Renaming C00 to C01 should cause the game to crash if you pick the C01 costume in the game. If it does not crash, you are not picking C01. (If you want to swap two models, you must change the package name in the metadata or use my asset injection tools.)

At first I also thought that the PKG model was wrong, but the model extracted from C_CHR009_C01.pkg is indeed the model of millium wearing a hat. I also tried your method, such as just deleting the hat grid, and then repacking, but the hat shape is still maintained after entering the game.
When I tried to change the name from C_CHR009_C00.pkg to C_CHR009_C01.pkg, the game didn't crash, and the millium in the game kept wearing the hat. I wonder if it's possible that the game doesn't read the model number C_CHR009_C01.pkg at all?

Posted
7 hours ago, lakovic said:

At first I also thought that the PKG model was wrong, but the model extracted from C_CHR009_C01.pkg is indeed the model of millium wearing a hat. I also tried your method, such as just deleting the hat grid, and then repacking, but the hat shape is still maintained after entering the game.
When I tried to change the name from C_CHR009_C00.pkg to C_CHR009_C01.pkg, the game didn't crash, and the millium in the game kept wearing the hat. I wonder if it's possible that the game doesn't read the model number C_CHR009_C01.pkg at all?

 

I looked it up in the CS4 table, and I believe that C_CHR009.pkg is the package you are looking for.  C_CHR009_C01.pkg is "Millium: No Pouch."

Posted
3 hours ago, amorrow28 said:

 

I looked it up in the CS4 table, and I believe that C_CHR009.pkg is the package you are looking for.  C_CHR009_C01.pkg is "Millium: No Pouch."

I tried chr_009 and it worked. Millium’s default suit should not have any c00 c01 at the back. Thank you very much??

 

Here is another problem that bothers me, that is, Angelica’s packaging problem. I modified the 1st, 6th, and 11th bits according to your method. After repackaging, Angelica lost part of the body (I guarantee that the missing part Didn't make any changes), and the girl in the screenshot also lost her body, can you help me find out the solution

Spoiler

Snipaste_2023-07-17_17-41-53.png.e85a7f44956fb99f1191847ba8f9d43f.pngSnipaste_2023-07-17_17-40-16.png.d44f28be4acbbb3a95b254a38b5fe287.png

 

If I only modify the metadata.json alone and leave nothing else, after packaging, the entire angelica will become transparent, and the girl next to her will still lose her body.

Posted
4 hours ago, lakovic said:

I tried chr_009 and it worked. Millium’s default suit should not have any c00 c01 at the back. Thank you very much??

 

Here is another problem that bothers me, that is, Angelica’s packaging problem. I modified the 1st, 6th, and 11th bits according to your method. After repackaging, Angelica lost part of the body (I guarantee that the missing part Didn't make any changes), and the girl in the screenshot also lost her body, can you help me find out the solution

  Reveal hidden contents

Snipaste_2023-07-17_17-41-53.png.e85a7f44956fb99f1191847ba8f9d43f.pngSnipaste_2023-07-17_17-40-16.png.d44f28be4acbbb3a95b254a38b5fe287.png

 

If I only modify the metadata.json alone and leave nothing else, after packaging, the entire angelica will become transparent, and the girl next to her will still lose her body.


wow, I do not know what is happening there at all. My tools do not seem to work as well with clouded leopard releases for some reason. I am still trying to figure that out.

Posted
On 7/14/2023 at 11:43 PM, FaxTM said:

It works great, Thanks for taking time out of your day to update it! One issue I can see though, her gun is invisible. I don't mind, since she isn't holding it in most of her screen time, but in battle and in cutscenes where she is holding her gun, its just not there.

Thanks for telling me! I can reproduce the issue and am looking into it.

Posted

@amorrow28hello,An error occurred when I packaged Duvalie\C_CHR035, I did not make any modifications, and both ED8ModTools_v2.2.0 and 2.2.1 had errors.

 

When I run runme.bat, the following error will appear. I didn't make any modifications, just unpacked and repacked

Spoiler

Snipaste_2023-07-21_19-28-36.png.7b684763d93a045866184cab0f05c018.png

 

Ines/chr_037 has the same problem, I haven't tested Ennea/chr_039, I guess they will have the same packing problem.
But I downloaded your PKG/CS3 version and found that all three of them are fine, and I use your pkg to unpack and then repack, and there is no problem.
Why is this?

Posted
39 minutes ago, lakovic said:

@amorrow28hello,An error occurred when I packaged Duvalie\C_CHR035, I did not make any modifications, and both ED8ModTools_v2.2.0 and 2.2.1 had errors.

 

When I run runme.bat, the following error will appear. I didn't make any modifications, just unpacked and repacked

  Reveal hidden contents

Snipaste_2023-07-21_19-28-36.png.7b684763d93a045866184cab0f05c018.png

 

Ines/chr_037 has the same problem, I haven't tested Ennea/chr_039, I guess they will have the same packing problem.
But I downloaded your PKG/CS3 version and found that all three of them are fine, and I use your pkg to unpack and then repack, and there is no problem.
Why is this?


Those three models need cube map support, which I removed in v2.2.0 because I thought those were only for towns and dungeons. I am trying to figure out the best way to add cube map support back.

 

As a temporary workaround, you can decompile with 2.1.8, and then compile with 2.2.1. Hopefully I will find a solution soon!

Posted
1 hour ago, takuteka said:

Thank you. 

スクリーンショット (478).png


Since my post has zero downloads, you must have downloaded the version I put up temporarily. The new version is fixed, please redownload.

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...