Feuleur / blender-dd2-tools-suite

Blender addon that provides a suite of importers and exporters for Dragon's Dogma 2 files.
MIT License
7 stars 1 forks source link

Exporting meshes with cloth physics breaks the physics #4

Open Alfheimen opened 1 month ago

Alfheimen commented 1 month ago

For example, when exporting grand cuirass (015) which is largely plate armor with a cloth skirt, the result is this: image image

Additionally, the skirt will be completely static. Doesn't seem to matter whether any changes have been made to the model before exporting; even when just importing -> exporting it seems to be problematic.

Also tried with a mage robe, eminent coat (008), which produces similar results for the bottom (i.e. waist down) part of the robe.

Feuleur commented 1 month ago

I confirm I can reproduce the issue with any armor with physics, I think I know what's missing in the exporter however I need to think about how to store that data when importing a mesh file in blender. It might take some time unfortunately.

Feuleur commented 1 month ago

The problem was twofold, mesh files have some secondary weight array that seems to be used for physics-related stuff: it's now added at import to the meshes in new weight groups with the "SHAPEKEY_" prefix, and used at export when present. If values are missing, those from the regular weight array are used.

That fixes the issue of parts of the armors flying away in the distance (presumably toward the origin of the map), however it seems meshes that use physics also use a secondary file (.gpuc.231011972) that seems to maps for each vertices of the meshes: so if any vertex is added or removed (removing LoD meshes counts too), subsequent vertices will be broken.

If that is truly what is causing the broken mesh issue, since handling this file format isn't supported for now, editing the concerned armor pieces will require either to not add or remove geometry, or to disable the .gpuc file by modifying the .pfb associated to the armor.

Alfheimen commented 1 month ago

Yep, it's exactly as you say; parts of the armor flying away is fixed, but adding or removing geometry breaks the mesh. However, a workaround to removing geometry for the time being is simply to set the scale for the part in question to 0, effectively making it invisible.