I've been trying to load an md5 file with Assimp for a while with no luck. I've used some example code that loads a simple .obj file without assimp to make sure my directx 11 code for creating vertex/index buffers, shaders and textures works. It seems like the problem is in the LoadModel method somewhere. I've removed the DirectX 11 specific code, since I got this to work with the example I found.

I'm not that experienced with 3d programming yet, so maybe there's a simple solution to my problem. Maybe it's rendered far away somewhere outside my frustum even. The model I'm trying to render is simple, and has one aiMesh and 24 vertices.

My shaders take pos, texCoord, normal and tangents. I also have a light that illuminates the whole texture. The shader is rendered with DrawIndexed(indexCount, 0, 0). I can provide some more code if necessary.

The semi-colon at the end of the loop means it won't actually loop through the code, it will only process it once, and what is 'imVertices'.

But the reason I don't think you're seeing anything on the screen is you aren't getting the vertex positions when loading (I'm wondering whether there is a mis-copy with the aforementioned for-loop, because you do use aiMesh->mVertices->x / y/ z). If the for-loop has been mis-copied then the following advice won't help and its possible something is going wrong when you are rendering, otherwise the loading code I use for assimp is as follows:[source lang="cpp"]for (UINT i=0; i < numVertices; i++){ const aiVector3D* pos = &(inMesh->mVertices[i]); const aiVector3D* normal = &(inMesh->mNormals[i]); const aiVector3D* texCoord; if (inMesh->HasTextureCoords(0)) texCoord = &(inMesh->mTextureCoords[0][i]); else texCoord = new aiVector3D(0.0f, 0.0f, 0.0f); Vertex v; v.mPos = XMFLOAT3(pos->x, pos->y, pos->z); v.mNormal = XMFLOAT3(normal->x, normal->y, normal->z); v.mTexCoord = XMFLOAT2(texCoord->x, texCoord->y); vertices.push_back(v);}[/source]

This does sound odd. I'm not sure what the problem could be. If you could link to the model that you are using I can try and see if my loader works when I get home from work. I seem to be doing something very similar to you at the moment because I've just finished writing the loading part of my engine/framework and I'm moving onto making games!

My problem isn't really restricted to certain model. I haven't gotten any of them to work with assimp. Maybe I need to do some kind of transformation for the model to show up where my camera is. I haven't had this issue with the other model loaders I've been trying though.

Good news is I can load the models using my loader (I tried the Bob.md5mesh and the BoarMan.md5mesh) so it is possible using Assimp. Odd thing about the BoarMan mesh is that there is not texture listed in the file (that I could see) so that model appears just black until you go far enough away to see it against the background:

Bad news being that it doesn't make it any clearer as to what you're problem is...

The difference between our code that I can tell is that you load the meshes that aiScene provides (which in the case of Bob.md5mesh is one) whereas I set a hierarchy of sub-meshes up using the aiScene's root node. This way I get 6 meshes for the individual bits of Bob.

I don't think just loading the one mesh from aiScene would make it not appear, I think it would just make the first mesh in the file appear which is his body so you should get at least that....

Only thing I can think is that maybe you're not loading the texture properly and the mesh is covering the whole screen and appearing black?

I was just about to explain why I thought you were only loading one because I could have sworn I'd seen when debugging that the aiScene only had a single mesh, but I just ran it again and it had 6... going mad I think!

The transformation matrices are just to work out how one sub-mesh is relative to its parent mesh so its not essential and you should at least be seeing something on screen. I'm at work at the moment, but when I get home tonight I'll edit this post with the code I am using / a link of where to download it from.

Yeah. That's what I figured the matrices were used for. They will be useful when I get this working.

Thanks for your help.

Didn't see your edit there to begin with. I'll check out your code soon. My code is a mess at the moment, since I've been refactoring and testing a lot. I'll see what I can do. Nice structure in your code though.