Jump to content
  • Advertisement
Sign in to follow this  
__Dominik

[DirectX11] [Assimp Textures] Have you ever seen anything similar?

This topic is 1092 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone!
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: 
WbPx5.png

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).

I tried drawing the loaded texture on a quad to see if it is loaded successfully and it is.

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.

Share this post


Link to post
Share on other sites
Advertisement

How is that different from the code I have provided? ... in my code "i" is meshID and "j" is vertindex (it is in cycle but that's written above)... UVIndex is always 0 because I have only 1 texture layer in my model that's for sure ... I could try to change the 0 to some other number just to see if assimp didn't put it in some other layer but I don't think that's going to work because then this call would crash because 0th layer would be nullptr (I think ... according to documentation) but thanks for trying

Share this post


Link to post
Share on other sites

Going back to the first assumption, how do you know it's an issue with the UV's? What's your input layout look like - does it exactly match the memory layout of your vertex buffer(s) and your vertex shader? What's the vertex and pixel shader do? Is the actual texture resource valid?

Have you captured the frame with a graphics debugger (e.g. visual studio graphics debugger or Renderdoc) and inspected the vertex attributes that you're actually delivering to the vertex shader?

Share this post


Link to post
Share on other sites

Sorry, missed that.

 

Have you used the AssimpView to verify that the texture coordinates are correct?

 

HTH

Yeah, I've done that before I started to even implement assimp libs to my code as long as any 3rd party library adds mess to any project so I wanted to make sure it would work.

 

Going back to the first assumption, how do you know it's an issue with the UV's? What's your input layout look like - does it exactly match the memory layout of your vertex buffer(s) and your vertex shader? What's the vertex and pixel shader do? Is the actual texture resource valid?

Have you captured the frame with a graphics debugger (e.g. visual studio graphics debugger or Renderdoc) and inspected the vertex attributes that you're actually delivering to the vertex shader?

Well, the shader worked for the demo model that was included with the Frank Luna's book and I used the same input layouts, therefore I automatically assumed that it should be fine for any model provided that I load it correctly into the same vertex layout, correct me if I am wrong.
I may try to look into some graphics debugger (but I'll need to find out how they work first).
Texture is loaded correctly I tried to draw it on quad and it displayed correctly .... however I used different (more basic) shader so I may try to display it using the same shader I use for model but as I stated above I don't think that's going to be a problem.

EDIT:
I tried to draw it on a quad with the shader I use and it is drawn correctly, however on first try I've put wrong tangentU and Normal vectors and it was all black with occasional white lines (with shades of correct texture) as I moved the camera, so I am adding a possibility of the problem to be wrong Normals or Tangents, I am adding my code of how I load those:

 
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;

BTW. whlie I am at it ... what's the difference between tangent and tangentU? Could that be the problem somehow? I can provide shader code if you want.

Edited by __Dominik

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!