XNA Creators Club Online
Page 1 of 1 (15 items)
Sort Posts: Previous Next

Problems using Blender Blender to creating models for an XNA project

Last post 05-20-2008 9:33 PM by ZuluPlumber. 14 replies.
  • 05-04-2008 7:00 AM

    Problems using Blender Blender to creating models for an XNA project

    Ok, so I've got to a point in my game engine where I actually need to think about replacing my placeholder graphics (Taken from the XNA samples) with some real graphics. So, I've had a look around on these forums and one common suggestion for a good free tool is Blender.

    So, I've installed it, watched the video tutorials and had a play around but I'm having a few problems.

    Firstly I tried creating a simple cube and exported it as an X file. In my game I replaced a placeholder graphic (Which was displaying fine) with the new cube X file, but nothing is being shown.

    Next, I thought I'd try loading one of the X files from the samples into Blender, but this doesn't work either. I just get a generic error message.

    I guess my question is, does Blender really work with X files? If so then why wont the samples load, and why don't the objects I create show up in game?

    Thanks in advance for your help.
    Ben

  • 05-04-2008 7:42 AM In reply to

    Re: Problems using Blender Blender to creating models for an XNA project

    First off, good choice for using Blender :)

    It is actually easy to get it going, with the problem of getting the models into your samples you might find that the model is there... just very small. The default scaling of the blender models is a lot smaller then the models supplied in the xna samples.

    As for x files, I would suggest looking at the fbx importer and exporter for blender.

    Here is a link to my site which has some blender articles that relate to XNA.

    http://www.virtualrealm.com.au/content/BlenderTutorials.aspx

  • 05-04-2008 9:23 PM In reply to

    Re: Problems using Blender Blender to creating models for an XNA project

    Does the fbx exporter have to be installed separately?  Where do I get it?  I've seen mention of an fbx exporter on a few websites (for Blender 2.44), but it doesn't appear in the menu with my fresh install of Blender 2.45.


    Good judgment comes from experience, and experience comes from bad judgment.  -- Barry LePatner

    Sixty years ago I knew everything; now I know nothing; education is a progressive discovery of our own ignorance. -- Will Durant, American philosopher/author [1885-1981]

  • 05-04-2008 9:44 PM In reply to

    Re: Problems using Blender Blender to creating models for an XNA project

    Yes it is supplied with the 2.45 and 2.46 versions of Blender. If you go to file and select export, on my edition here it is the third export script down (Autodesk fbx).
  • 05-04-2008 10:03 PM In reply to

    Re: Problems using Blender Blender to creating models for an XNA project

    How strange... it isn't in my menu.

    Good judgment comes from experience, and experience comes from bad judgment.  -- Barry LePatner

    Sixty years ago I knew everything; now I know nothing; education is a progressive discovery of our own ignorance. -- Will Durant, American philosopher/author [1885-1981]

  • 05-04-2008 10:30 PM In reply to

    Re: Problems using Blender Blender to creating models for an XNA project

    The script should be located here C:\Program Files\Blender Foundation\Blender\.blender\scripts. That is off course if you installed to the default directories.

    The script is called export_fbx.py if it is not there You can re download the version of blender 2.45+, make sure you grab the zip as well. You then have the choice of a reinstall over the top, or unzip the zip file and just copy the scripts to the directory.

     

  • 05-04-2008 10:48 PM In reply to

    Re: Problems using Blender Blender to creating models for an XNA project

    It wasn't there.  I downloaded the zip and replaced it.  Thanks.

    Good judgment comes from experience, and experience comes from bad judgment.  -- Barry LePatner

    Sixty years ago I knew everything; now I know nothing; education is a progressive discovery of our own ignorance. -- Will Durant, American philosopher/author [1885-1981]

  • 05-04-2008 11:35 PM In reply to

    Re: Problems using Blender Blender to creating models for an XNA project

    Not a problem Glad to help.
  • 05-05-2008 6:01 AM In reply to

    Re: Problems using Blender Blender to creating models for an XNA project

    Thanks for your reply. Yes maybe the model is there but just too small. I'll try scaling it and see what happens.

    Also thanks for the link to your tutorials.

    Regards
    Ben

  • 05-09-2008 4:39 AM In reply to

    Re: Problems using Blender Blender to creating models for an XNA project

    I also use Blender for creating models for my game and I always export to .X format.  I use the default DirectX exporter that comes with Blender.  It took some trial and error with the settings at first, but now everything is working.

    When using Blender make sure you remove any additional vertices before exporting (in edit mode hit W, then "Remove Doubles").  Also be sure to apply any modifiers in object mode (like sub surf) before exporting - e.g. you may have added the modifier but not yet applied it.  Another thing I learned to watch out for is the origin location of your model in Blender (you will see it as a little pink dot, and it's the point that your model rotates around when you rotate it).  As you create your model you may find that the origin has moved, and when you render it in XNA it may not be where you expected it because of that origin value.  I set my origin to 0,0,0 for simplicity sake.

    Glenn mentioned checking for a really small model, also be careful of a really big model.  If your camera is "inside" your model then you may not even see it because your camera is looking through the model from the inside out.  You don't see the texture or model because the normal is facing away from you.

    If you keep working with .X files and have problems let me know as I've overcome quite a few snags (the main ones listed above).  I've written up a step by step guide on my project's wiki for exporting models from Blender to XNA (.X format), and I would like to add something similar to the XNA wiki whenever I get around to it (unless someome beats me to it!).

    Hope that helps.
  • 05-09-2008 7:42 AM In reply to

    Re: Problems using Blender Blender to creating models for an XNA project

    I wouldn't be so sure with that removing duplication of vertices.
    For instance:
    Hard faces vs smooth faces. Generate a hemisphere that will have proper normals... The only proper way I know to do that is by duplicating vertices (edge splitter modifier actually does this). There are other -  less efficient - ways also... like adding more information per vertex.

    .X files should be considered testing/easy start format as it's formally dead. I advice getting to your own format sooner or later. The biggest mistake is to keep stuborn to old format when you really need "your" format. I am still using sometimes .X in my own simple projects. But when it comes to quality and rich graphic content I put it on shelf.

  • 05-09-2008 3:32 PM In reply to

    Re: Problems using Blender Blender to creating models for an XNA project

    Thanks Phil for the good advise! I look forward to the wiki! :)


  • 05-09-2008 3:34 PM In reply to

    Re: Problems using Blender Blender to creating models for an XNA project

    Debesciak:
    .X files should be considered testing/easy start format as it's formally dead. I advice getting to your own format sooner or later. The biggest mistake is to keep stuborn to old format when you really need "your" format. I am still using sometimes .X in my own simple projects. But when it comes to quality and rich graphic content I put it on shelf.


    I'm n