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: