Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I've downloaded a bunch of 3d models from turbosquid.com. The majority of the one's I've downloaded are simply .fbx files. When I load the model into my game and run it, the following error is thrown in mesh.draw():

An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.Graphics.dll

Additional information: The current vertex declaration does not include all the elements required by the current vertex shader. TextureCoordinate0 is missing.

All the answers I've found online seem to tell people to reexport the model, or change something in the shader. I don't have access to these, just the fbx file. What can I do?

share|improve this question
    
It sounds like the content importer is discarding the texture coordinate component for the mesh vertices. Do you happen to have the source for the content importer? –  RobCurr Mar 29 '13 at 4:17
    
I'm not sure what you mean, I'm kind of new to this. I'm calling Content.Load<Model>(@"Models\model") to load it... –  robev Mar 29 '13 at 21:58

2 Answers 2

As an alternative to adding textures to your model, you can stop the default BasicEffect from looking for them when drawing.

//foreach BasicEffect basicEffect in model.mesh[n].effects ....

basicEffect.TexturesEnabled = false;

//begin effect pass...
share|improve this answer

Your model is missing the Texture Coordinates. You need to unwrap the model in a 3D modeling program, then export it.

share|improve this answer
    
Often the models come with no UV wrapping, basically. If you look when you're browsing and downloading the models they will often say if they have textures or UV mapping. IF they don't, you'll have to import it into something yourself and do the texture mapping. –  DrHeinous Apr 29 '13 at 14:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.