1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Animation in DirectX

Discussion in 'Tools programming' started by Luis_Sá, 22/7/09.

  1. Luis_Sá

    Luis_Sá Resource contributor

    Joined:
    16/9/04
    Messages:
    314
    Country:
    portugal
    Hello,

    I am sorry for this question that is not directly related to FS but I imagine that many designers and tool developers coming here could easily clarify me.

    I want to build a windows application (using dot net and managed DirectX9) to animate an object. I have several .X files (about a dozen), each one storing a mesh of the object in a particular take (I think I can call these keyframes - the meshes have the same number of points and faces). My application will load those meshes and then, after some user input, a time line is defined to control the animation. I know how to render the object. My question is related to the generation of intermediate meshes. For example I have mesh_A defined at time T1 and mesh_B defined at time T2. I need to create intermediate meshes along 40 ms intervals that exist between T1 and T2. I found a function that interpolates between corresponding vertices of 2 meshes:

    http://books.google.pt/books?id=CE-...stH4Dw&sa=X&oi=book_result&ct=result&resnum=1

    but that means that the CPU has to cycle between all the vertex of the 2 meshes to create the intermediate mesh. Is there a more efficient way to accomplish that? I thought there was a chance that GPUs could already do that. :confused:

    Many thanks in advance for any tip.

    Best Regards, Luis
  2. beatle

    beatle

    Joined:
    28/9/06
    Messages:
    324
    Country:
    us-virginia
    I think you would want to use either a vertex shader or a geometry shader, but I believe geometry shaders are only available in DX10 (and early DX10 hardware sucks for geometry shaders :-> ).

    Also the Managed DirectX 9 code is extremely old, and was never really supported even when it was being developed, so you may want to look into using XNA instead.

    If you can get by with Shader Level 2.0, you might also be able to use the 3D support in WPF 3.5 (or the beta 4.0), but I haven't played with any of that yet so don't know if it will do what you need or not.
  3. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17/9/05
    Messages:
    24,716
    Country:
    wales
    Tim

    Am I right in thinking that WPF 3.5 supports 3D directly?
  4. beatle

    beatle

    Joined:
    28/9/06
    Messages:
    324
    Country:
    us-virginia
    Yes, it has some support for 3D (and I believe 4.0 adds more, or at least makes it more efficient :-> ), but like I said, I haven't really spent any time playing with that yet myself. You start with a Viewport3D control - here's a link to the online docs that describe the 3D graphics abilities of 3.5: http://msdn.microsoft.com/en-us/library/ms746698.aspx.

    I've also seen a few articles on Codeplex.com showing how to do a hybrid solution, using C#/WPF as the main app/UI layer, then using interop to talk to native C++ code that does the heavy DirectX lifting - I was actually planning to look into doing that with the existing FS engine as a self assigned background task before the studio was shut down.
  5. some1

    some1

    Joined:
    22/3/08
    Messages:
    6
    Country:
    poland
  6. beatle

    beatle

    Joined:
    28/9/06
    Messages:
    324
    Country:
    us-virginia
    That does look interesting.

Share This Page