Sign in to follow this  
danromeo

XNA 4 Instanced Modeling Sample problem

Recommended Posts

Can somebody tell me why when I replace the model in the XNA 4 Instanced Modeling sample with the attached model the model doesn't draw when in Hardware Instancing mode? 

 

This is a sample model that I borrowed, not my own creation.  It has a single part and appears to be properly rigged for XNA.  It works fine in any of the other modes.  The Instanced Model sample works fine in all modes with the model that is included with the sample.  For testing purposes I changed the pixel shader to output float4(1,0,0,1) to rule out any problems with the texture.  All I get is a cornflower blue background.  I'm using the Instanced Model sample here: http://xbox.create.msdn.com/en-US/education/catalog/sample/mesh_instancing, the only changes being replacing the model and the pixel shader output mentioned above.  I am using the Instanced Model content processor included with the sample to process the model.   

 

The model that I'm testing with and the texture that it links to are here:

 

 
 
THANKS!

Share this post


Link to post
Share on other sites

YUP!  Good call.

 

16 bit IndexElementSize with 188,000 indices.  Of course the short answer is to use simpler models and this test model is gross overkill for instancing.  Wondering though, Is there a way to change the IndexElementSize after creation of the buffer?  Otherwise a 32 bit size would require rewriting the MeshPart class??  Or is this a function of the modeling app (Blender)???

 

Thanks Steve.

Share this post


Link to post
Share on other sites

Postmortem: Steve was right that my model had too many indices, but even a simpler model still wouldn't render in Hardware Instancing mode.  

 

It turns out I was exporting the model armature in Blender, which I found after comparing a working model with a non-working model.  In Blender, select all objects EXCEPT the armatures, then in the .FBX export check "Selected Objects" and then export.  Model now works in the MS Hardware Instancing sample. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this