3D Cloth Source Code Posted: Technique for WPF 3D Morph Mesh

There is a great 3D cloth demo that has been floating around interally for awhile and shown at conferences, talks, channel 9 interviews, etc. However, we haven't ever posted the source code . . . until now.  You can run it from here and download the source code here.

I didn't write this code; David Teitlebaum, from the WPF team, did. He was hesitant to release it as the code isn't factored to his liking, but I convinced him otherwise.  His code is interesting to read: Thing3D is my personal favorite class. It is also worth calling out that he uses no XAML and he also uses a MatrixCamera instead of the more easy-to-grok PerspectiveCamera and OrthographicCamera.  And the technique he uses for morphing the mesh is to swap out vertices on the fly using a timer, again not for the feint of heart. But, if you already know 3D paradigms and are wondering how to create stunning effects like this in WPF, this source code will be illuminating for you. 

If you can't run the application because you either aren't on Vista or haven't installed .NET 3.0 on XP, here are some pics to give you a sense of the effect as the cloth, which is really just a 20 x 20 vertice plane, drops onto a sphere, bounces and slides onto a cube:

You can run it from here and download the source code here.

Comments

  • Anonymous
    February 26, 2007
    PingBack from http://cheatcodedirect.com/3d-cloth-source-code-posted-technique-for-wpf-3d-morph-mesh/

  • Anonymous
    February 26, 2007
    Thanks Karsten for your effort to get David to release his code. It's appreciated.

  • Anonymous
    February 27, 2007
    For some reason, I can't run any "clickonce" applications on my computer.   When I clicked on the link for this application, it opened a separate browser window that closed in a couple of seconds, but nothing ever runs.  Any ideas?  I am running Windows XP Pro Service Pack 2 with IE 6.  I have .NET 3.0 installed. Thanks.

  • Anonymous
    February 27, 2007
    Hmm -- no error message?  Anything in the event log?

  • Anonymous
    February 28, 2007
    Karsten, What event log are you referring to?  And no, there is not an error.

  • Anonymous
    March 01, 2007
    I looked in the local settings/apps/2.0 directory and there were items loaded, but nothing for this application.  I deleted the 2.0 directory, and tried to launch the application again.  Still nothing happens, and the 2.0 directory wasn't even recreated.  I also checked the event logs on my laptop, and I saw nothing out of the ordinary.

  • Anonymous
    March 04, 2007
    Fantastic stuff - very impressive!

  • Anonymous
    March 05, 2007
    Wow ... I supposed WPF 3D is only for some easy 3D effects ... but this is really impressive ... what will be next, Halo IV completely coded in WPF? ;]

  • Anonymous
    March 06, 2007
    this is impressive, indeed! it opens up a new age in developing online solutions... ..i'm not so familiar with this WPF-Stuff right now; all that i know is that we are not going to learn xaml:-) is there a rad available right now? greetings from germany!

  • Anonymous
    March 07, 2007
    By RAD, I assume you mean tooling.  Check out Expression Blend (http://www.microsoft.com/expression).  For importing 3D assets, check out Mike Swanson's tooling page: http://blogs.msdn.com/mswanson/articles/WPFToolsAndControls.aspx

  • Anonymous
    April 23, 2008
    Știați că în XAML/WPF: există styling asemeni celui din CSS pt HTML? un co