Microsoft Developer Network > Forums Home > Archived Forums Forums > XNA Game Studio Express > How to import a 3d Model in XNA framework?
Ask a questionAsk a question
 

AnswerHow to import a 3d Model in XNA framework?

  • Friday, September 01, 2006 10:39 AMMehdi Mahdloo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Can anyone explain me howto import a 3d model in an XNA project? In which format I have to export my model from 3ds max 7?

Answers

All Replies

  • Friday, September 01, 2006 11:38 AMShinzo-Prime Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    As far as I know, the current BETA has no loading routines for 3D modell formats. It seems they are part of the content pipeline which will be implemented later, so you must write your own model file reading code for now. My advice is the Wavefront OBJ format, which is a very well documented ascii format. It's also supported by the most modelling programs like Wings3D, Maya, 3DS-MAX, Anim8or...

    Look here for detailed imformation: http://www.fileformat.info/format/wavefrontobj/

  • Friday, September 01, 2006 12:04 PMX-Tatic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I created a .X to .SWM converter.

    x2swm - http://astaroth.beatbuggy.net:8080/Downloads/x2swm.zip

    It's not properly tested, so let me know if it works ok.

  • Friday, September 01, 2006 12:46 PMJocphone Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    thanks for posting this converter.

    Now, I don't like to look a gift horse in the mouth and all that, but would it be possible for you to post this as source? I understand if you are restricted by work or such but you will appreciate we have to be very careful about downloading .exe files and such.

    cheers, Joc
  • Friday, September 01, 2006 1:08 PMMehdi Mahdloo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks X-Tactic for te converter...i'll try it...
  • Friday, September 01, 2006 1:29 PMMClever Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    What would be great now is if somebody posted a tutorial for loading and using SWM files, methinks it's a bit simpler than it looks - I'm just going off extracting the code from Space Wars at the moment to write some helper methods for it...
  • Friday, September 01, 2006 1:42 PMX-Tatic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     Jocphone wrote:
    Hi,

    thanks for posting this converter.

    Now, I don't like to look a gift horse in the mouth and all that, but would it be possible for you to post this as source? I understand if you are restricted by work or such but you will appreciate we have to be very careful about downloading .exe files and such.

    cheers, Joc

     

    Don't worry, its perfectly safe :)

    Unless you save over some .swm you didint want to, but thats about it.

  • Friday, September 01, 2006 1:48 PMX-Tatic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    The SWM is fairly simple. Here's how its structured:

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=685166&SiteID=1

     

  • Friday, September 01, 2006 3:15 PMJocphone Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Don't worry, its perfectly safe :)

    That's the trouble tho', I do worry and downloading .exe files posted on forums
    is beyond the level of risk that I'm willing to take with a work computer so I will
    have to pass unfortunately.

    cheers, Joc


  • Friday, September 01, 2006 3:45 PMX-Tatic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     Jocphone wrote:
    Don't worry, its perfectly safe :)

    That's the trouble tho', I do worry and downloading .exe files posted on forums
    is beyond the level of risk that I'm willing to take with a work computer so I will
    have to pass unfortunately.

    cheers, Joc


    Ok fair enough, If you don't want to use it theres no problem.

  • Saturday, September 02, 2006 3:38 PMX-Tatic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Alright, heres a new version:

    Updates:

    .swm now contains vertex format string

    more verbose error descriptions

    Get it here: http://astaroth.beatbuggy.net:8080/Downloads/x2swm_1_0_0_1.zip

  • Saturday, September 02, 2006 4:39 PMMatute Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    It fails! it gives the following error:

    Mesh format clone failed

    :-(

  • Saturday, September 02, 2006 5:04 PMX-Tatic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
     Matute wrote:
    It fails! it gives the following error:

    Mesh format clone failed

    :-(

    I updated the cloning a little, hopefully it will fix your problem.

    Heres an updated version with modifed cloning:

    http://astaroth.beatbuggy.net:8080/Downloads/x2swm_1_0_0_2.zip

  • Saturday, September 02, 2006 6:53 PMMehdi Mahdloo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I used your converter X-Tactic and it works great!
  • Saturday, September 02, 2006 8:47 PMX-Tatic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Your welcome.
  • Sunday, September 03, 2006 2:33 AMAnton Bursch Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    X-Tatic

    I used your .exe and it caused a massive collapse of my system.  I rebooted and suddenly the power in my house went out.  Then I looked outside and noticed that power had gone out in the whole neighborhood.  Then suddenly the power came back on and so did my computer.  But, there was still something 'wrong' with my computer.  Instead of windows coming up... it was just this blank screen with the words:

    Shall we play a game?

  • Sunday, September 03, 2006 11:38 AMX-Tatic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    ..lol
  • Sunday, September 03, 2006 1:38 PMX-Tatic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I uploaded a new version of x2swm:

    Fixes:

    Batch vertices now have the proper offset

    batch Indices are now correct.

    can perform multiple conversions without restarting the application.

    Get it here: http://astaroth.beatbuggy.net:8080/Downloads/x2swm_1_0_0_3.zip

    I converted many .x files successfully with this version . Here is an image showing .swm rendering in XNA:

    http://astaroth.beatbuggy.net:8080/Images/XNAMagic/x2swm_success.jpg

    Enjoy!

  • Tuesday, September 05, 2006 11:02 PMSynced Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Any chance someone could put up a tutorial thats simply how to import a .swm file and how to render it in 3D?

    I find the Spacewar tutorial a little much to learn simple basics sometimes. I want to learn the basics then I can start adding caches etc.

    Thanks!

  • Wednesday, September 06, 2006 8:45 PMX-Tatic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
  • Friday, September 15, 2006 10:10 PMMehdi Mahdloo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    X-Tatic...your SimpleMesh game component is simply brillant  :)