From 25794f0a5849dcfd06ac3ce55d5b10d4845989e9 Mon Sep 17 00:00:00 2001 From: Fothsid <18036123+Fothsid@users.noreply.github.com> Date: Sun, 15 Aug 2021 21:24:44 +0500 Subject: [PATCH] whoops forgot that normals need transformations as well --- src/convert_to_nbd.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/convert_to_nbd.cpp b/src/convert_to_nbd.cpp index fa9b711..d517d15 100644 --- a/src/convert_to_nbd.cpp +++ b/src/convert_to_nbd.cpp @@ -410,9 +410,11 @@ static void FillMesh(FbxManager* sdkManager, OBMesh& mesh, FbxNode* node) mesh.normalList->list.resize(vertices.size()); for (int i = 0; i < vertices.size(); i++) { - mesh.normalList->list[i].x = vertices[i].nx; - mesh.normalList->list[i].y = vertices[i].ny; - mesh.normalList->list[i].z = vertices[i].nz; + FbxVector4 normal(vertices[i].nx, vertices[i].ny, vertices[i].nz); + normal = matrix.Inverse() * normal; + mesh.normalList->list[i].x = normal[0]; + mesh.normalList->list[i].y = normal[1]; + mesh.normalList->list[i].z = normal[2]; } }