Making XNAnimation play nice with Static models

Feb 22, 2010 at 10:46 PM

While I'll admit I haven't looked terribly hard as of yet, I can't find much in the way of how to use XNAnimation with static models.  Namely, getting the lighting consistent.  At this moment, I'm using BasicEffect for my static meshes, and the SkinnedModelBasicEffect for skinned meshes.  I'm having absolutely no luck getting skinned and static models to light even remotely similar using the same values, however.  Does XNAnimation support static meshes itself?  Does anyone have any tips for getting the results I want in general?

Developer
Feb 22, 2010 at 10:53 PM

Yup, check the AttachModel sample. The weapon model is shaded with the SkinnedModelBasicEffect, but it doesn't have any animations at all! There is no need to create an AnimationController for it, because the transformation matrix is calculated manually; you can use the same procedure for your static models.

Feb 22, 2010 at 11:17 PM

That's good to hear, but it doesn't seem to like it when I change my static models to use the XNAnimation content processor because they lack bones.  Does the machine gun contain a bone to make it compatible?  Is this what I'm going to have to do?

Developer
Feb 22, 2010 at 11:21 PM

Are you using a X model or a FBX one? AFAIK, FBX format puts some bones in your model (even if they aren't rigged) so that wouldn't be a problem (just ignore the warning about the lack of animations in the model).

Or, as a last resort, copy from SkinnedModelEffect.fx the shading functionality and use it in your own shader for static models.

Feb 22, 2010 at 11:25 PM

I'm using FBX models, and I'm getting

error : Input model does not contain a skeleton.

during the Content-building phase of compiling, so it doesn't really give me the choice to ignore the warning. =]

 

Developer
Feb 22, 2010 at 11:33 PM

Are you exporting from Maya, or another tool that isn't 3DS Max?

Feb 22, 2010 at 11:37 PM

I'm exporting from Blender, using the one plugin everyone said I should download rather than using the default one.

Is the issue that I'm not getting a bone by default?  Is this remediable by simply manually adding an arbitrary bone? 

Developer
Feb 22, 2010 at 11:41 PM

Well, it looks like Max is the only tool that forces rigging for meshes (perhaps Maya and XSI too?). And yes, you can solve your problem by creating a bone and rigging your mesh to it. Export it and then XNAnimation won't complain anymore.

Feb 22, 2010 at 11:46 PM

I'll do this then -- Thanks a lot for your help. =]

Feb 26, 2010 at 8:52 PM

hey

 ima having the same problem. i have an .fbx model with animation on it , but no  bones, just a tank firing ,  but  to use this lib  i created a bone and rigged my mesh to it , it gives the following error

"has a geometry that does not have a skinning blend weights channel."

Is there any other way out ??