From 738912861d2cd74942af4c2974490650ed9ae01d Mon Sep 17 00:00:00 2001 From: watlok <3468540+watlok@users.noreply.github.com> Date: Sun, 21 Dec 2025 15:13:03 -0500 Subject: [PATCH 1/3] See line 612 in mikktspace.c --- mikktspace.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mikktspace.odin b/mikktspace.odin index dcadb68..fca7d5b 100644 --- a/mikktspace.odin +++ b/mikktspace.odin @@ -525,7 +525,7 @@ merge_verts_fast :: proc(piTriList_in_and_out: []int, pTmpVert: []Tmp_Vert, pCon // is no longer strictly between fMin and fMax values. if fSep >= fvMax[channel] || fSep <= fvMin[channel] { // complete the weld - for l in 0 ..= iR_in { + for l in iL_in ..= iR_in { i := pTmpVert[l].index index := piTriList_in_and_out[i] vP := get_position(pContext, index) From df71ccecd069e5b98e48924573492dc4fa9ff548 Mon Sep 17 00:00:00 2001 From: watlok <3468540+watlok@users.noreply.github.com> Date: Sun, 21 Dec 2025 15:13:42 -0500 Subject: [PATCH 2/3] Correct bitangent generation. See line 986 in mikktspace.c --- mikktspace.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mikktspace.odin b/mikktspace.odin index fca7d5b..b2cdaae 100644 --- a/mikktspace.odin +++ b/mikktspace.odin @@ -898,7 +898,7 @@ init_tri_info :: proc(pTriInfos: []Tri_Info, piTriListIn: []int, pContext: ^Cont fSignedAreaSTx2 := t21x * t31y - t21y * t31x vOs := (t31y * d1) - (t21y * d2) - vOt := (-t31x * d1) - (t21x * d2) + vOt := (-t31x * d1) + (t21x * d2) if fSignedAreaSTx2 > 0.0 { pTriInfos[f].iFlag |= {.OrientPreserving} From e975a3147d126e063a86914e0f84ba90cb7ce0ea Mon Sep 17 00:00:00 2001 From: watlok <3468540+watlok@users.noreply.github.com> Date: Sun, 21 Dec 2025 15:14:54 -0500 Subject: [PATCH 3/3] Could generate incorrect tangents and caused sign flip on final tangent.xyz result. See line 995 in mikktspace.c --- mikktspace.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mikktspace.odin b/mikktspace.odin index b2cdaae..7a30b0a 100644 --- a/mikktspace.odin +++ b/mikktspace.odin @@ -908,7 +908,7 @@ init_tri_info :: proc(pTriInfos: []Tri_Info, piTriListIn: []int, pContext: ^Cont fAbsArea := math.abs(fSignedAreaSTx2) fLenOs := linalg.length(vOs) fLenOt := linalg.length(vOt) - fS: f32 = .OrientPreserving in pTriInfos[f].iFlag ? (-1.0) : 1.0 + fS: f32 = .OrientPreserving in pTriInfos[f].iFlag ? 1.0 : (-1.0) if fLenOs != 0.0 do pTriInfos[f].vOs = (fS / fLenOs) * vOs if fLenOt != 0.0 do pTriInfos[f].vOt = (fS / fLenOt) * vOt