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
    
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

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.