niftools / blender_niftools_addon

The Blender Niftools Addon is a Blender add-on to enable import and export of NetImmese File Formats including .nif, .kf, .egm.
http://www.niftools.org
Other
386 stars 104 forks source link

Mesh is not split on mirrored UVs #586

Closed ja231c closed 11 months ago

ja231c commented 1 year ago

Issue Overview

As tangents and bitangents are per-vertex and UV-relative and there is only one vertex and tangents and/or bitangents need to go in different directions when UVs are mirrored since the UV goes in a different direction.

Version Information

Blender Niftools Addon Version Info

0.0.15 from commit 67e0f92158c7135d0e7095b07ee1dc81f0c4a205

Blender Version Info

3.5.0

Platform information

Windows 10

Context

Mirrored UVs are a great way to reduce texture size without affecting texel density. NiTriShapeData/BSTriShape stores only one tangent and bitangent per vertex.

Steps to Reproduce

Export mesh with mirrored UVs.

Expected Result

Vertexes get split where the UV is mirrored.

Actual Result

There is only on vertex on the mirror, which has tangents and/or bitangents that are not correct

Possible Fix

Split mesh where this happens.

Screenshot

Expected Result (note the lack of line) good_small Current Result (note the line) bad_small

Blend File

Blend.zip

Nif File

NIFs.zip

Candoran2 commented 1 year ago

I don't expect there to be a difference, since we didn't make any changes to tangents/bitangent export. However, have you tried v0.1.0 instead of 0.0.15?

HENDRIX-ZT2 commented 1 year ago

I believe bitangents have never been involved in the splitting code. Not sure though. Yes, when a mesh stores bitangents, they need to be taken into consideration for duplicating vertices.