# Assimp Texture Coords problem

I've got a problem when loading objects using assimp. I did succesfully load vertex data and I am able to draw static mesh (without bones and animations, I've got few bugs there but I'll go back to solving that problem after I solve this one). Back to the problem. I have loaded texture coords using this code

tmp.Tex.x = modelScene->mMeshes[i]->mTextureCoords[0][j].x;
tmp.Tex.y = modelScene->mMeshes[i]->mTextureCoords[0][j].y;


of course it is in cycle for all meshes and all vertices (i, j respectively).

Then I draw it using DirectX 11 and I get this result:

I tried almost all permutations of post loading flags that had something to do with UV coordinates and nothing helped (only the yellow spots changed it's color to green in some cases).

Textures should be loaded correctly (I checked file names in debugger and they were correct) then I loaded it using directX functions for that so no problems should not there.

The code for drawing is basically the same as in the book from Frank Luna, with minor changes (because I redesigned the whole framework to my needs). Shader is whole from the book.

I am hopeless already. I am looking for working way to load my models (fbx, dae) to my demo for almost 2 months now and nothing worked (this is the closest I've got), so if anyone have seen anything similar I would be really grateful for any pointers on where to look for problem.

Here is the source image

EDIT 1: So I tried to draw the texture on the quad using the same shader I use for drawing on model and somehow I used wrong TangentU and Normals what resulted in the picture on quad being black with occasional (when I moved camera) white stripes with shades of the actual texture so can't this problem have anything to do with tangents or normals? Or maybe something with TangentU being something different than actual Tangent? Code I use to load those is:

tmp.Normal.x = modelScene->mMeshes[i]->mNormals[j].x;
tmp.Normal.y = modelScene->mMeshes[i]->mNormals[j].y;
tmp.Normal.z = modelScene->mMeshes[i]->mNormals[j].z;

tmp.TangentU.x = modelScene->mMeshes[i]->mTangents[j].x;
tmp.TangentU.y = modelScene->mMeshes[i]->mTangents[j].y;
tmp.TangentU.z = modelScene->mMeshes[i]->mTangents[j].z;

• I would try just drawing the textures on a quad first and make sure they're actually loading correctly (and with correct settings) – CobaltHex Oct 22 '15 at 2:34
• @CobaltHex Sorry for taking so much time, but school and stuff .... I tried it and it is loaded correctly (at least it is drawn correctly so I suppose it should be loaded correctly) .... My opinion is that the problem is somewhere in the texture coords but I looked at other people sollutions and it always was done this way so I completely do not understant where to look for a problem. :( But thanks anyway, at least someone tried. – Dominik Oct 23 '15 at 14:42
• can you upload the texture to here or somewhere just for reference? – CobaltHex Oct 23 '15 at 18:05
• @CobaltHex Yeah sure no problem, I could upload the whole model if you wanted to try it in your loader or something, just ask Here is my GDrive folder ... I'll put all other files anyone ask for in there: drive.google.com/… – Dominik Oct 23 '15 at 18:50
• Have you tried the import flag for flipping the UV coordinates when the mesh is imported? – Yattabyte Oct 25 '15 at 4:43

So as many implied, it was problem with shader, or better said SSAO and/or shadow mapping.

I went back to the working demo that was attached to the book and used my Loader there and it worked. The problem was that in my framework I deleted the parts that were SSAO and ShadowMap related, and that somehow (I didn't study the shader code very much) caused the problem.

Hovewer I still had a problem with the texture being mirrored. I solved this by FlipWindingOrder flag and dissabling flipUVs flag.

Another additional problem with this model but not with another one I ran into was some weird 'shadow like' triangles all over my model. This was solved by going back to FBX model as the one I used was DAE converted from FBX using FBX View tool from Autodesk.

Thanks everyone for helping.