Hello, I am trying to load an .obj file as an IAnimatedSceneNode; I'm able to get the .obj model loaded into the level but it has no texture, there is a .mtl file provided with the model which I am assuming is the texture but when I apply it to the model it's still textureless.
Can someone please enlighten me as to what's going on here?
You cannot apply an mtl as a texture. The .mtl is just a text-based material descriptor file that automatically links to the obj. Look inside of it and see if you can find the texture path it specifies. If you did you would realise It doesn't specify any texture path nor does the model have any uv's assigned. The models geometry itself is quite messy and will need cleaning up first. Try opening it up in Blender or some other Mesh Editor.
Also .obj files generally hold no Animation data, so unless you're going to manually animate the mesh in code, there is no need to use an IAnimtedMeshSceneNode.
This instead would be better in that case:
You load it correctly, and I assume that you also see the model, just not textures. The mtl file does not contain any texture information, only basic shading settings. There is no texture anyway, besides the ammunition counter on the side. The rest of the model is meant to be colored by the light materials. Which means that you have to enable lighting to get the proper colors, as the .obj loader does not copy the vertex color IIRC. This model is not usable for any gameplay, anyway, as it seems to be not just high, but max poly. The file has about 5MB of data, and it's just a gun.
Yes, I went with another model that had an included texture file and left the post to make sure my code was correct, on a side note, does anyone know of a good site for free model resources?
I don't know which program you use to make the model, but you must make an UV Map. I think there are alot of tutorials around the www
After exporting it to .obj, look into the mtl file with a normal texteditor, and write in the path to the texture with the UV Map.
Then just load it, and it must work
Hope this helps ( when you didn't find the solution already)
MynithiX
Two things are infinite: the stupidity of the humans and universe. I'm just not sure if the universe is really infinite! YOLO