Monday, September 22, 2008

DirectX Mesh Loading

It's been awhile since my last post. I got a little burned out on meshes after working on the xfile format. I did recently write a little app that lets me load my walking sequence and walk the little "Jake" model around. Here's a video.

This is just a DirectX 8 application with a skinned .x file loaded. I'm going to create a really simple character and start playing with breaking up the animations by lower and upper body as well as moving the head where the camera is pointing. It will support jump, swing, run, walk, back up, sit, and lay. We'll see how it goes. After that I might start working on lighting a little. but, it would be neat to get more than one person moving things. My editor is comign along well. I have a short buglist and then its on to deployment code. If anyone is interested in trying it out let me know in the reply.

Happy Coding!


  1. Anonymous9/27/2008

    Hi! Well done!
    I Just started my 2nd game engine attempt (the first one is almost finished, written in c#/XNA)
    Now i'm using c++/DirectX9 and making a new model format,including animation, i think i can make the model format without any problems, but i have to learn to use skeletal animation (moving bones separetely). I have lots of loaders for a framed animation but have no idea of how to access bones matrices. Can you help me?
    You can contact me at:
    You're welcome if you want to join our project, thanks.

  2. Looks great! That kid is a little indecisive about where he's going, isn't he? Keep working hard!

  3. Anonymous11/10/2008

    Yeah! excellent work.. thats what i needed badly .I m working in DIrectX 10 with C# . I have to load a .x file in DIRECTX10 ,really dont know the commands ,will you please help me out with this. Please send the code of yours.

    I have my final project ,but loading .x file is making problem

    my id is

    I will be very thankful if you will help me ! :)

  4. Anonymous4/05/2009

    Excellent, I am writing a small game but I am using visual c++, I have a little problem when I tried to move a single mesh, the world moves too. I use this funtcion:


    But that is for the world, not for a single mesh, do you know the function to move a single mesh?, the mesh I have only have a function to draw:-DrawSubset function- in the intellisense of visual studio dot net.

  5. Anonymous4/05/2009

    Sorry I forgot to post my e mail:

    ¿How I can moves meshes separately?

    I am using visual 2008 express edition and directx 9 sdk

  6. Hi Diego.
    I sent you an e-mail but I wanted to put the comment in the blog as well.

    I think you're on to the right track. You just need to draw your world first and then draw your model.

    For example, if you have a plane or quad and it is from -10,0,-10 to 10,0,10, the world transform was equal to the idenity matrix, that's where it would render.

    Next, let's say you have a character at 2,0,2. You offset the world matrix after drawing the first quad. Next you draw your character with the updated matrix. Done! Let me know if you have further issues.

    happy coding!

  7. can you help me, I need do something like that, I want to know how to put an animation in C #.
    In what type of format, .x?
    I apreciate if you can help with a part of code or something to do this kind of animation.

  8. hi. this is great! I just trying to animate X file. how do I do it in

    this is my email


  9. Hi Eko,
    You've just reached one of those "Jedi Trials" for graphic developers.

    I sent you an e-mail. Just wanted to post in blog for others.

    Animating an XFile is difficult. With VB.NET you can use DX8/DX9 but you may want to look into making the jump from Managed DirectX(MDX) to XNA development. Microsoft didn't come out with MDX for DX10. It is possible to do it still.

    Anyway, check out the XNA Gamers club for animation sample and if you go with DX9 instead take a look at the SDK that comes with some samples on animating "tiny.x"

    Also, don't commit to .x format(probably going a way) if you can help it. Go with whatever has the most tutorials.

    Happy Coding!

  10. Hi everyone,
    great work there.

    I've got a similar project where I only have to render or show a 3d object in c#.

    I tried to do it with .x files but not able to so far. can anyone please help me.