2
\$\begingroup\$

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?

\$\endgroup\$
2
  • \$\begingroup\$ 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? \$\endgroup\$
    – RobCurr
    Commented Mar 29, 2013 at 4:17
  • \$\begingroup\$ 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... \$\endgroup\$
    – robev
    Commented Mar 29, 2013 at 21:58

2 Answers 2

2
\$\begingroup\$

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...
\$\endgroup\$
0
\$\begingroup\$

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

\$\endgroup\$
1
  • \$\begingroup\$ 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. \$\endgroup\$
    – DrHeinous
    Commented Apr 29, 2013 at 14:07

You must log in to answer this question.

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