In part 1, I looked at the Content Pipeline and it’s components. In this article, I will be looking at the files I am going to be importing and the tool I will be using to create them.
Why Blender?
Blender is an open-source 3D modelling package which is under active development by the Blender Foundation, a non-profit public benefit corporation. It is released under the terms of the GNU Public License and is free for anyone to download and run on a wide-range of platforms, including Windows. There is a huge active community around the world currently using Blender.
It offers functionality to rival that of commercial packages, it’s very quick and it has a user interface that is centred on making your workflow as fast as possible.
Because Blender is free, there’ll be no worry that you’ll have to ditch it’s use when you one day decide to release a game. That might not be the case with using a learning edition version of a commercial package.
Exporting from Blender
Because of the open nature of Blender people can extend it to provide export tools for others to use. This is made possible by having Blender integrated with Python, another open-source package. Python is a script-based language that is often used to enable macros or scripting support in other applications.
As you can see from the image, there are quite a few different export plugins that come with Blender upon install. You might notice that XNA already supports two of the formats in this list: FBX (Autodesk) and X (DirectX). I actually don’t want to those though. I want to use Collada.
Why Collada?
Collada files are XML files, firstly. This makes them really easy to parse and also really easy to explore in Visual C# Express.
It’s an open standard which has the remit to provide a standard format for exchange of 3D assets between applications. The potential in the future is that this plugin can support all those other applications.
The Plan
By using Collada, I hope to make my ContentImporter support as much of it’s flexibility as possible. Then it would be useful just as a general purpose Collada importer for interfacing with other packages and tools you may wish to create. A level editor, for example.
It should be possible to use the plugin to read Collada files into the standard XNA Model class (which I think many users would want) but I also want to explore using it to import into custom classes. My plan is not to just use this to import meshes, but to import other things such as bounding boxes, level floor plans or skeletal animations.
The Code
Right now it is not ready for release in any form. The current status is I have written the ContentImporter, ContentProcessor, ContentTypeWriter, and ContentTypeReader and I’ve dropped a few test blender meshes into my current version of my framework:
A centred cube.
Two cube meshes in different positions and rotations.
Two instances of the same cube mesh but in different positions and rotations.
A cube made from multiple materials.
The Blender Suzanne built-in test model (pictured right).
The good news?
They all import without errors. By tracing through the whole process with the simple cube models, I can see that the data is being passed through to my rendering code. The issue I have is that I have written the full pipeline form scratch and could be introducing problems at any point. In fact the current screen display is this:

I’m literally in the dark as to what is happening in the code. The data is passed to the graphics device and I just have to cross my fingers and hope it will work.
To investigate this, I need to use PIX the DirectX debugging tool.
I’ll put up an unsupported demo once I can iron out the rendering bugs, just so people can take a look but then the next task is to package it into more user-friendly plugins they can just drop into their existing projects.
Next time…
I’ll be looking at the Collada file format in more detail with a glimpse of some code examples to show how it will be parsed. I’ll also document progress on my work with PIX, something I think will be an interesting task.

[...] Read part 2 March 08th, 2008 | 01:20 am | XNA, XNA with Blender | | [...]
Trackback this post | Subscribe to the comments via RSS Feed