0
\$\begingroup\$

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: problem view

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
Texture

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;
\$\endgroup\$
12
  • \$\begingroup\$ I would try just drawing the textures on a quad first and make sure they're actually loading correctly (and with correct settings) \$\endgroup\$
    – CobaltHex
    Commented Oct 22, 2015 at 2:34
  • \$\begingroup\$ @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. \$\endgroup\$
    – Dominik
    Commented Oct 23, 2015 at 14:42
  • \$\begingroup\$ can you upload the texture to here or somewhere just for reference? \$\endgroup\$
    – CobaltHex
    Commented Oct 23, 2015 at 18:05
  • \$\begingroup\$ @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/… \$\endgroup\$
    – Dominik
    Commented Oct 23, 2015 at 18:50
  • \$\begingroup\$ Have you tried the import flag for flipping the UV coordinates when the mesh is imported? \$\endgroup\$
    – Yattabyte
    Commented Oct 25, 2015 at 4:43

2 Answers 2

0
\$\begingroup\$

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.

\$\endgroup\$
0
\$\begingroup\$

I encountered the same problem. Simply for my project, removing aiProcess_JoinIdenticalVertices from the flags of Assimp::Importer::ReadFile worked. For my project, this flag is OK for loading .dae files, but results in this problem when loading .fbx files.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .