Freigeben über


Xaml Export Script for Blender

[UPDATE: The Xaml Exporter now is hosted on CodePlex (here) ]  

The 3D features in the Windows Presentation Foundation make it easier than ever to integrate 3D content into your applications.  However, unless you are satisfied with basic solid geometry you are going to need more than just the WPF.  You’re going to need 3D authoring tools to create interesting content.

Unfortunately 3D tools tend to use their own proprietary file formats with limited import/export support for other formats.  Xaml, being new to the scene (no pun intended), is not yet supported by most tools.  However, some modeling programs feature an add-in architecture that allows custom exporters to be written by 3rd parties.  The free 3D software package Blender is such a tool.

All very interesting you say, but where is this going?

I have posted a new release of the 3D Tools for the WPF which includes a Python script to export Blender scenes as Xaml.  The Xaml can then be dynamically loaded or compiled into your WPF applications.  Figure 1a shows a 3D model being edited with Blender.  Figure 1b shows the final exported Xaml as viewed with the WPF Model Viewer.

Figure 1aThe Steve Ballmer model* is authored in Blender and then exported to Xaml. Figure 1bThe final model as it appears in the WPF Model Viewer.

(Click for full sized images)

Because the WPF and Blender have different goals for their rendering engines their feature sets do not match precisely.  Specifically, the WPF uses the hardware accelerated real-time rendering capabilities of your GPU.  Blender is a software based rendering engine not targeted at real-time applications.  However, the results of the export are frequently quite good.  Figure 2a is the same 3D model as rendered by Blender.  Figure 2b is the exported model viewed from a similar angle with the same lighting configuration in the WPF Model Viewer.

Figure 2aSteve Ballmer model* rendered using Blender’s internal software engine. Figure 2bExported model rendered using the WPF. The blue background is not part of the scene.

(Click for full sized images)

To get the Xaml Export Script for Blender and the WPF Model Viewer download the latest version of the 3D Tools for WPF (available here).  Copy the xaml_export.py script to your Blender scripts directory.  Blender will automatically add the script to the ~File~Export menu the next time it is started.  More detailed instructions and a list of known issues are included in the Read-Me.

* Steve Ballmer model courtesy of Bonnie Lehenbauer

Comments

  • Anonymous
    January 19, 2006
    The comment has been removed
  • Anonymous
    January 20, 2006
    You are quite welcome. :)

    Note that there is a Bug Tracker page in the workspace where you can report issues with the exporter:

    http://www.gotdotnet.com/workspaces/bugtracker/home.aspx?id=2ce2a6b8-2085-4839-a001-1c539525f5fa
  • Anonymous
    February 25, 2006
    I've posted a minor release of the 3D Tools for the Windows Presentation Foundation which is built against...
  • Anonymous
    February 26, 2006
    Instead of writing individual blog posts for each WPF tool or control that I become aware of, I thought...
  • Anonymous
    June 19, 2006
    Je vois de plus en plus d’articles sur le web qui compare XAML à certains formats de fichier 3D basés...
  • Anonymous
    August 28, 2006
    First Open Movie…
    I have been fascinated by open source technology and business models for some time...
  • Anonymous
    April 16, 2007
    The last few days I played around with the 3d capabilities of the Windows Presentation Foundation (WPF).