I have made a 3D game engine, and as part of this I use
Assimp to load in meshes to my game. One of the meshes I load in is my
terrain.obj mesh that I made and exported from
Blender(Version 2.82). The issue is that I noticed in my game the terrain is flipped, for example in
Blender a certain mountain will have a valley next to it, but in my game that valley and mountain are at opposite sides of the mesh from each other, as if the model in my game has had its mesh vertices flipped on an
z axis, I don't understand why this is happening, I would assume the model I export from
Blender and load into my game with
assimp should be identical.
My blender export settings are as follows:
The image you see above is the default export settings, I have changed nothing except I scale the model up by x64 and untick the
write materials option.
My assimp code that loads in the mesh is as follows:
Assimp::Importer importer; const aiScene* scene = importer.ReadFile(("../res/models/" + fileName).c_str(), aiProcess_Triangulate | aiProcess_GenSmoothNormals | aiProcess_FlipUVs | aiProcess_CalcTangentSpace);
I noticed that
aiProcess_FlipUVs sounded suspect because of the word "flip", and could possibly be the issue so I commented it out and this actually made the mesh load in exactly as it is in blender, that is all the hills and valleys are where they are supposed to be and not at opposite sides of the terrain from each other. But commenting this out also made the game world (terrain mesh) load in upside down, and upon swinging my camera around completely so that it was the write way up, my look controls (up / down / left / right) are all inverted.
Therefore, does anyone know how to correctly export the mesh from
Blender and import it using
Assimp so that the mesh exported from
Blender is identical to the mesh imported with
Assimp without removing the line of code
aiProcess_FlipUVs as it may have solved the flipped mesh vertices issue but my controls and game world are inverted. I am new to
Assimp so there must be something I am doing wrong or have missed.