I am using Assimp for my models in my game. I am loading obj models exported from blender, into my classes through a model loader that utilizes Assimp.
I've run into an issue. Now right off the bat I know my shaders are correct, and the trasformation of lights are as well (in my Vertex Shader) since the only meshes that have the soon to be metioned issue are models exported and imported through Assimp.
It seems as if assimp is flipping my models normal vectors! Check the two images below, and it seems as if the backside of my model''s normals are pointing inward!
vsOut.pos = mul(vertex.pos, worldMat);
vsOut.pos = mul(vsOut.pos , viewMat);
vsOut.pos = mul(vsOut.pos , projMat);
vsOut.color = vertex.color;
vsOut.wPos = mul(vertex.pos, worldMat);
cameraPos = mul(vsOut.pos, worldMat);
cameraPos = mul(cameraPos, viewMat);
vsOut.viewDir = camPos.xyz - vsOut.wPos.xyz;
vsOut.viewDir = normalize(vsOut.viewDir);
vsOut.norm = mul(vertex.norm, worldMat);
vsOut.norm = normalize(vsOut.norm);
These are my preprocess flags for Assimp and This is how I load the normals in code
unsigned int processFlags =
aiProcess_ConvertToLeftHanded | // convert everything to D3D left handed space (by default right-handed, for OpenGL)
vertexVectorL.at(i).norm = XMFLOAT3(mesh->mNormals[i].x, mesh->mNormals[i].y, mesh->mNormals[i].z);
Has anyone else heard about assimp doing this? It's been throwing me for a loop for a while now.
If something looks off in my code give me a hint or point me in the right direction!
P.s. I've included screen shots of the issue
Thanks for any reply an advance!