I am working on a runtime mesh loader using Assimp. My meshes are rendered fine with this code
vertex.X = vertexT.x * 100.f;
vertex.Y = vertexT.y * 100.f;
vertex.Z = vertexT.z * 100.f;
normal.X = normalT.x;
normal.Y = normalT.y;
normal.Z = normalT.z;
vertexT is the vertex from Assimp and vertex is fed to an instance of UProceduralMeshComponent.
However, I want to display all objects in a right-hand coordinate frame. So I tried this
vertex.X = vertexT.x * 100.f;
vertex.Y = -vertexT.y * 100.f;
vertex.Z = vertexT.z * 100.f;
normal.X = normalT.x;
normal.Y = -normalT.y;
normal.Z = normalT.z;
The vertex positions seem fine but the normal vectors are all wrong. I only see black surfaces.
What is a proper way to transform the normal? Is there a way to let unreal recompute the normal automatically with UProceduralMeshComponent?