Creating 3D Models for WPF

I’ve had an opportunity recently to play around with WPF’s 3D capabilities to try and recreate part of the Tesco product viewer demo at PDC08. Of course one of the first hurdles is actually having some sort of 3D model to play with (once you get bored with a cube). There are lots of sites where you can download 3D models in various formats (many of them chargeable) but I wanted to understand a little about the tools and techniques so I decided to build a few simple 3D models myself.

I plumped for Blender as my 3D tool primarily because it’s powerful and it’s free. As I don’t do much 3D design work I can’t really justify spending a lot of money on a tool. I only scraped the surface of Blender’s capabilities in my journey but it was a lot of fun. There are some great resources for learning to use Blender out here. In particular I found the materials from Neal Hirsig to be simply fantastic:

As for the WPF aspects, I found this tutorial by Mike Hodnick to be clear and simple enough to give me all I needed to get started.

I’ve recorded a few screencasts which take you through building a simple 3D model and creating a simple WPF application like this one (screenshot below) but I’m having problems uploading to Channel9 so it make be a couple of days before they’re available.

ScreenShot

I also thought it might be useful to share the 3D models I created.

Box WineBottle

CD Yoghurt

I’ve uploaded the XAML files for each of these models to https://mikeo.co.uk/cs/files/4/wpf_3d_xaml_models/default.aspx. It should be a simple case of creating a new WPF application and just pasting in the XAML. All but the cardboard box require two images in the project, by default called Image1.jpg and Image2.jpg, for the artwork.

There are lots of ways the XAML could be optimised (most notable you’ll probably want to encapsulate elements as resources) but it’s a good starting point I think. There are undoubtedly ways to improve the models – I’d love to hear where I’ve gone wrong!

Technorati Tags: wpf,xaml,3d,blend,blender