FoldingCube3D

Some days ago MS spread giveaways of a real folding cube to the community. That was a perfect model for fiddling out the 3D concepts in WPF.

At first it was hard to find the right way how to combine languages and tools for modeling and animation. I started modeling the cube with triangles, normals, camera and light by switching forth and back between doing it in C# and XAML. But at least since working out the needed animations a tool must be found for this. You don’t really want to crawl down the visual tree just to find the right dependency property for the next transformation. Not to mention setting up texture coordinates by hand! So ZAM3D came into play.

With this tool it seemed to be just an effort of time to realize the animations and clashing textures to the cubicles. The latter was really comfortable whereas with the rotation animations a certain problem could not be solved (at least with the current knowledge): Let the cube consist of 8 small cubicles. The cube can take up to 6 different states. Rotating and translating a single cubicle is not a big thing. But doing several rotations in sequence and maybe rotating several cubicles in parallel brought a strange effect: Cubicles in a row get somehow displaced although they should move in parallel according to what was modeled. The downloadable source in this posting does contain the latest .z3d file containing the problematic situation. So with the current ZAM3D Feb 2007 CTP build 129 I did not figure out what’s behind all this.

Switching back to procedural/descriptive modeling I went without multiple textures and sadly did all animations manually. Thanks to the 3DTools extending the model with mouse navigation is quite nifty now.

The combinational use of Expression Design and Expression Blend was very usefully to create the graphical resources and polishing the UI design. Even though UI was mostly done in the XAML editor of Visual Studio 2005.

Finally a book I recommend warmly for digging into the pitfalls of WPF is “Windows Presentation Foundation Unleashed” by Adam Nathan. It also contains a great part on 3D graphics written by Daniel Lehenbauer.

Download sources (store and rename filename by removing “.jpg” at the end of the name).
Download XBAP (store and rename filename by removing “.jpg” at the end of the name).

FoldingCube3D

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s