lslib
lslib copied to clipboard
Duplicate/flipped faces causing broken UVs and non-manifold geometry on model export
I'll preface this by saying that I'm far from an expert with Blender, so I'm not sure if this is an issue with the export process or my workflow/inexperience.
It seems that importing a BG3 .dae converted with either 1.19.3 or 1.18.7 results in randomly flipped/missing faces and a partially overlapping UV if the model contains double sided cloth (capes, skirts, etc):
I'm guessing this happens because some vertices share exact coordinates and are lost in the conversion process. I've fixed this issue on several models by merging vertices by distance, recalculating normals to get a single sided version of the model, then duplicating the mesh and flipping normals on the duplicate. An even lazier option would be to just duplicate the unmodified mesh and flip normals on the duplicate, which also works.
However, the above process won't work on the below model because it uses a different UV island for each side of the cloth, and the UV map ends up with holes in it:
I'm not sure if this is something that can be fixed in the export process or if there's an easy way to repair the UVs that I'm not aware of. I get the same result whether I convert the model with the ConverterApp and import the resulting file through Blender's standard .dae importer, or directly import the .gr2 file using the Blender addon: https://github.com/Norbyte/dos2de_collada_exporter
Hi,
What's the use case for exporting double-sided verts? When the game needs this (eg. for cloth physics proxies), they keep two layers of vertices for the front side and the backside at some distance from each other. Base game materials always do backface culling.
Again, I'm relatively new to modelling, but it's my understanding that retaining both sets of vertices would preserve the UV maps for objects with a single face thickness and different textures on each side, the cape in my second screenshot being a key example. It would also hopefully prevent the issue in my first screenshot as well, since vertices wouldn't be removed at random with face direction being determined by the surviving ones.
If there's a better way to retain the original UV map and prevent flipped faces, I'd be more than happy with that solution as well.
Moreover, retaining both sets of faces would allow exported objects to render from both sides as the original meshes do. Here's the skirt mesh from my first screenshot as an example.
Vanilla:
Extracted model, imported to Blender, and exported back to GR2 with no alterations:
Above, but with face directions fixed by hand:
This particular example can be fixed manually by duplicating the faces and flipping normals on the duplicates, but it's an additional step that can add up when you're refitting 300+ clothing/armor models to a new body shape.
That being said, I imagine the second screenshot above is not the expected result of the import/export process alone, so something is amiss.