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

real time cloth

Last post 10/29/2009 3:09 AM by ShadowyCore. 5 replies.
  • 11/9/2008 8:42 AM

    real time cloth

    I was wondering if xna allowed you to simulate cloth in real time or if their was a plug in. I know you could always do it the hard way and animate the cloth but I think it would look better if u could do a real time simulation.
  • 11/9/2008 7:02 PM In reply to

    Re: real time cloth

    I don't think there's any plug-ins in the sense of reactor or sim cloth available for xna, it doesn't really work like that. You could always try creating a plane in your selected modelling package, then import it into XNA and implement a vertex shader to do a cloth simulation on the GPU. Here is a video of cloth in XNA, the author of the video says he created it based on an article on gamasutra, I haven't checked it out, but there's a link in the description.
     
    Perhaps another forum member will be able to offer up an easier solution.
    Lost C1tY
  • 11/9/2008 7:10 PM In reply to

    Re: real time cloth

    By allow do you mean "it's possible to write real-time cloth physics simulations in XNA" or "some handy component in the framework that does it all for you?"

    You can write real-time Cloth Simulation in XNA (I've seen videos of it on YouTube) but you're not going to find some magical ClothSimulation = On; command. You will either have to write the simulation yourself or find a sample online. XNA is not a game engine, it doesn't come with a list of features like those. With it, designers can put together engines with any list of features they want. Because of that, any feature imaginable is possible as long as the designer has the skill to implement it.
  • 11/10/2008 3:19 PM In reply to

    Re: real time cloth

    Real time cloth is prohibitively expensive in regards to processing time. You'll find that even massive AAA game titles avoid it, for example if you look at Star Wars: Force Unleashed, although they had many systems for AI and DMM destructibles they still chose to use a smooth skinned mesh for all cloth elements. The easiest example is to look for any video of the Sith Robe, which looked quite bad while the character jumps and runs.

    For a class is physical simulation I wrote a springy mesh simulation, you can download here. This is an XNA 3.0 sample. The controls are:
    Left Trigger : Zoom Out
    Right Trigger: Zoom in
    A Button: Reset
    Left Stick: Pull single point on mesh
    Right Stick: Rotate Camera


    This is an example done for a class assignment to meet specific requirements and would need to be cleaned up a bit before being used for anything. To see some differences in the buildBox function change the last two parameters to 4000, 4000. Or even higher for a stiffer spring.

    The reason I post this is because cloth simulation is at heart a springy mesh, with the introduction of multiple types of springs. Then the implimentation of self collision detection to prevent interpenetration and similar issues. If you have access to it, through your school or local public library. The ACM database has many articles about cloth simulation if that's what your actually after. If your just trying to make your game look pretty it most likely isn't worth it.

    -White
  • 11/10/2008 6:13 PM In reply to

    Re: real time cloth

    yea it seems like it's more trouble than it's worth. I know how to animate it using a skinned character I just wanted to know if their was a way to do it real time I fiquired it would look better if it simulated differently every time.  But it's not worth sacrificing the games performance especially when I can get close to the same results using ik.
  • 10/29/2009 3:09 AM In reply to

    Re: real time cloth

    You might appreciate this article:
    http://www.ziggyware.com/readarticle.php?article_id=229
    Freefall Game Engine - In Development
Page 1 of 1 (6 items) Previous Next