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 downloaded this code sample and integrated it into my game http://xbox.create.msdn.com/en-US/education/catalog/sample/mesh_instancing

It works with the model that they supplied, but throws and exception whenever I use one of my models.

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

I tried pluging my model into their original source code and same thing. My model is an fbx from blender and has a texture. This is the function that throws the error

GraphicsDevice.DrawInstancedPrimitives(
  PrimitiveType.TriangleList,
  0, 0,
  meshPart.NumVertices,
  meshPart.StartIndex, 
  meshPart.PrimitiveCount, 
  instances.Length
);
share|improve this question

put on hold as off-topic by Josh Petrie 7 hours ago

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about debugging a problem in your project must present a concise selection of code and context so as to allow a reader to diagnose the issue without needing to read all of your code or to engage in extensive back-and-forth dialog. For more information, see this meta thread." – Josh Petrie
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Does your model have textures? It says TextureCoordinate0 is missing, that might mean that there is no texture or UV data in the model file. It is also possible that you are trying to use a file of a different version than that of what the program was designed for. –  smoth190 Aug 14 '12 at 17:24
    
I have a Clouds style texture that blender generates. Im not useing an image based texture –  FreakinaBox Aug 14 '12 at 17:57
2  
I haven't done XNA in a few months but I remember having a similar issue. When you exported to fbx from blender, did you check the "Strict XNA" option? Also, try doing an unwrap on your model and then exporting. I know sometimes i had issues when it expected an unwrapped model but it didnt have the UV data –  Mungoid Aug 14 '12 at 18:25
    
I think Mungoid is right. Make sure you have assigned UV-coordinates before exporting. You do know that your generated clouds texture will not be exported in the model, right? So you will still have to assign a texture with UV-coords if you are using a shader with texture coloring in XNA –  Mikael Högström Aug 14 '12 at 19:32
    
Procedurally generated textures will not export as an image with the model by default. –  ChrisC Aug 14 '12 at 21:56

Browse other questions tagged or ask your own question.