This project is read-only.

need correct export parameters for a mesh in Blender

Feb 1, 2010 at 11:44 PM

Hi all,

I created a simple 3D scene in Blender that I'm trying to display in my game (it's my first 3D in XNA/Xen)

I tried to export it with default setting,  but everything is messed up.

I need correct export parameters for a mesh in Blender. I'm using Blender 2.49b and the DirectX exporter that comes with it.

Also do I need to change any settings in the properties of the Xen Model content processor?

I'm using the Actor class from the tutorials and a FirstPersonControlledCamera3D with zUp to false. I've tried lots of export settings, but I get inverted normals, at one point the X axis was flipped or with some settings it all looks good the light does not appear on the right side of the polygons.

I made Blender draw the normals for each models and they all are on the right side

Feb 2, 2010 at 1:47 PM
Edited Feb 2, 2010 at 1:50 PM

Hi Iarus, I'm not familiar with Blender (I'm not a content guy :) so I can't help you directly.

I remember someone else had problems with flipped normals in blender. Unfortunately I don't recall how they fixed it.

However, I do know there is a very comprehensive two part tutorial on using Xen/XNA with Blender. The catch is it's in Russian.
You can find it (using google translate) here: (the top two links)

Hope that helps.

Feb 3, 2010 at 1:46 AM

thanks looks like a nice article, I've read the 1rst part. I'll read the 2nd part and look into it more in depth, I was looking for something simpler! Like "Hey you forgot to activate option X." or something.

Maybe some other Xen user found the solution, anyway, thanks. I'll go read it some more

Feb 5, 2010 at 8:38 PM

Yay! I found out what was not working. Blender exports with the wrong winding order and your ModelImporter as a bug.

in xen\src\Xen.Ex.ModelImporter\ModelImporter.cs the swap winding order does not work.

On line#714 : remove the declaration of the useless variable "swapWinding"

On line#159 : use the "SwapWindingOrder" property instead

The property window expose SwapWindingOrder and implicitly through this property the variable swapWindingOrder, but the code uses swapWinding.

I'll probably default the "SwapWindingOrder" property to true, as it's what I'll want most of the time..

Now I export from Blender with "Swap zy" to ON (Y-axis up) and "Filp z" to ON (left handed system).

And in the property window of the exported mesh I turn on the "Swap winding order" option.