Blender 3D, XNA and a little bone bending
- Posted: Sep 23, 2011 at 6:00 AM
- 10,902 Views
- 1 Comment
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Today's project shows off using Blender, a free open source 3D design utility, and XNA. Two great tastes that taste great together... ![]()
Animating single bones in a Blender 3D model with XNA
There are some good examples around that show how to make animations in a 3D package and play them back in XNA, but what if you want your animations to be more than standard 'walk', 'run', 'jump', etc.? What if you want your 3D model to interact with its 3D environment? Well, then you need to be able to animate single parts of your 3D model through manipulating the model with your code. This tutorial attempts to show you how to develop a simple 3D Model using Blender, put in some armature bones, and finally how to manipulate them in XNA using C#.
...
Tasks
First, what I hope to do here is to show you how to:
- Generate a simple Mesh in Blender (a tube)
- Add a Skin to the Mesh using UV unwrapping
- Add Armatures (Bones) to the Mesh
- Tell the Mesh how to deform when the Armatures/Bones move
- Export the Mesh, Armatures, and Skin in a format that XNA can use
- Bring the Model into XNA with a custom content pipeline
- Through code, manipulate the Mesh through moving the Armatures
XNA
So we now have a Model that we should be able to use in XNA. To get the Model into our game, we need to import it through the content pipeline. The content pipeline takes our content and normalises it so that it appears to our game as standard structured objects that we can use in our game. I'm basing the XNA part of this project on the sample provided by MS. The skinned model sample uses an existing model that has a built-in animation (walk) that the code runs. While this is great, I want to demonstrate how you might manipulate one joint on its own rather than run a pre-defined animation (incidentally, if you use the same code as I'm demonstrating with the 'dude' model, you can get the 'dude' to do so very unlikely gymnastics!).
Content Pipeline
The Skinned model sample loads it's 'dude.fdx' model through a custom content pipeline. We are going to make some modifications to the pipeline so that it doesn't load the animations from our 'tube' model because we don't have any. To do this, open the Skinned Model solution, go to the SkinnedModelPipeline project, and remove the methods
ProcessAnimations(both) and comment out the initialisation of the animation's dictionary.
If you're interested in using XNA with 3D models from a tool like Blender, this story should be right up your alley...
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
This is great. Very simple and practical, thanks!
Remove this comment
Remove this thread
close