I want to present very useful feature “XAML exporter for 3D Studio Max”. This feature contains number of MAX-Script files with code that allows exporting 3D scenes from 3D Studio Max to XAML files. “Max2Xaml” Project on Codeplex website: http://max2xaml.codeplex.com.
I’ll try to present a simple guide for this feature with some useful example.
Software requirements for this guide: 3D Studio Max 2007 or later (I use 3D Studio Max 2009), Microsoft Expression Blend 2.0 (Final Release).
SDK and Framework requirements: Microsoft .Net 3.0 or 3.5.
Let’s start:
(1) Download ZIP File from here and extract it to some directory on your hard drive.

(2) Open/build scene with 3D objects in 3ds Max.

(3) Ensure that each object has definition of material (this required by “Max2Xaml”).

(4) Go to “MAXScript” sub-menu and click on “Run Script … ”.

(5) Select “Main.ms” script file from extracted directory and click on “Open”.

(6) Click on “Export” in dialog-box.

(7) Type file name (with “xaml” extension) and click on “Save”.

(8) This is “MAXScript” Editor window with XAML output of current scene:

The output contains XAML code for “ResourceDictionary” that contains data for definitions of all scene models/objects,

materials,

and other data.

(9) Open/create new WPF project in Blend.

(10) Add existing item to project tree.

(11) Selected created XAML file and click “Open”.

(12) After addition of new resource dictionary merge it with resource dictionary in target window.

(13) Add “Viewport3D” object into main grid (this object is used to display 3D scenes/objects).

(14) Added “Viewport3D” already contains default camera. Add “ModelVisual3D” objects for each 3D model from the scene.

(15) Link each model’s geometry to resource from merged dictionary.


(16) Material of each model can be linked to resource from merged dictionary.

(17) Probably we’ll not see the 3D models.

(18) We can adjust camera’s position and other parameters, and then we’ll see the models.

(19) If models are black or still invisible, add new “ModelVisual3D” with light (can be “DirectionalLight”) that will “radiate” on scene objects.

(20) After some adjustments of camera and light we’ll see imported models from 3ds Max.

The example project with code can be downloaded from here
.
Summary: Some WPF projects require complex 3D models in 3D scenes, these complex models can be made in 3D modeling software like 3ds Max and imported into WPF. This post shows how to port 3D models from 3ds Max to WPF. See next post(s) with guide for porting 3D models from “Blender” to WPF.
PS
I’m not responsible for any damage that may be caused by using this post or its content. Any materials in this post were provided AS IS without any changes and other meanings.