AdrienTD / wktools

Warrior Kings (Battles) game files modding and viewing tools
MIT License
5 stars 0 forks source link

Failed to open file in obj2wkm ; modified mesh crash exe. #2

Open VladimirChalanov opened 2 years ago

VladimirChalanov commented 2 years ago

Hello, I have a problem when working with mesh files.

I'm trying to translate mesh3 files of the original Warrior Kings into Russian (text on arrows, path: ...\Map Briefing\Animation*.MESH3).

I wanted to convert mesh3 to obj+mtl and convert back to mesh3 without changes, but the latest version of obj2wkm says "Error: failed to open file". I build obj2wkm from source - the problem recurred. I found an old version 0.1 - it works, but the game crashes if a modified mesh should appear.

I tried mesh_blender_addon with blender-2.79b and blender-2.79-e045fe53f1b0 with different combination of "Apply modifiers" and "Swap Y & Z coordinates" settings. The created mesh is invisible in game or crash exe. I also tried to change the spearmen mesh - as soon as you create it in the barrack the game crashes (like WK and WKB). At the same time, tool wkm3v displays modified files without problems.

Did you manage to see the modified mesh file in the game?

cmd

blender

AdrienTD commented 2 years ago

I believe the problem is that you might not have the file "wkNormalTable.bin". Be sure that the file is in the same folder as "obj2wkm.exe". The older version v0.1 worked because it didn't need that file, but then your object would have incorrect shading. Also, this tool is old and I highly recommend using the Blender addon instead.

Speaking of the Blender addon, I have a newer version that is compatible with Blender 2.8x and later (maybe even 3.x iirc), but even though I uploaded it on a WK Discord server, it seems I haven't uploaded it on GitHub yet. My apologies. I will attach it here WK_Mesh3_Anim3_Blender_2_80_Addon.zip.

You said you did a test with the Spearman, however note that the Spearman has animations ("anim3" files). If you import the Spearman mesh3 and export it back, there's a risk it will get slightly modified (different vertex order, different number of vertices, etc.), and this can make all anim3 files imcompatible with the mesh. Did you try with a mesh that is not animated? (for example: stockade, bush, rock, statue, ...) And does it work?

VladimirChalanov commented 2 years ago

Yes, now obj2wkm is working. It's just that the atdwkmk5.zip archive does not contain the wkNormalTable.bin file and the readme does not point to it. Later I will check the mesh in the game and the new blender addon.

VladimirChalanov commented 2 years ago

I checked the work of the blender addon - it works fine, but it's strange that before exporting you need to switch to texture paint mode, and if this is not done, the model will be without texture (I'm new to using blender, maybe this is normal). Meshes without animations turned out both through blender and through obj2wkm.

This issue can be closed, but you should add a notice about the absence of wkNormalTable.bin to the source code, otherwise it is not clear what is meant by "Error: failed to open file".

Another off-topic question - is it possible to recreate the animation with simple means? It will be a problem for me to get into the original.

AdrienTD commented 2 years ago

it works fine, but it's strange that before exporting you need to switch to texture paint mode, and if this is not done, the model will be without texture

Normally you should export in Object mode, and set the texture to the material. The addon will take the filename of the texture. For example you set the material to a texture with filename Abaddon.tga, then after export the game will look for the file Abaddon.tga in the "Warrior Kings Game Set\Textures" folder.

I could add a notice about the wkNormalTable.bin file, but at the same time I don't really want to encourage anyone to use obj2wkm, nor the MD2 converters, since they are obsolete and superseded by the Blender addon. What I will probably do is upload the newer version of the addon and recommend everyone to use this instead. I might leave both v2.79 and 2.8+ versions, just in case, even though it is always preferable to use the latest version of Blender.

is it possible to recreate the animation with simple means?

You can't import animations with the addon. Even if it could import them, you would have them in shape keys as it is using vertex animation and not skeletal animation, which would be harder to edit. If your goal is to translate the game, I don't think this is going to be an issue, since most models that have text on it are these arrows shown in the cutscenes like in your screenshot above, and they are all static meshes as far as I know.

VladimirChalanov commented 2 years ago

Unfortunately, these arrows have an animation of moving around the "Map of Orbis". Anyway, thanks for the help.