Click here to Skip to main content
15,905,068 members
Articles / Desktop Programming / WPF

WPF 3D - Kerkythea Exporter

Rate me:
Please Sign up or sign in to vote.
3.50/5 (3 votes)
10 Jul 2009Ms-PL1 min read 54K   3.8K   25   8
Export the WPF 3D scene graph to raytracing/radiosity rendering software (Kerkythea)


WPF 3D is a real-time rendering method. To get the highest quality renderings of 3D scenes, it is necessary to use a non real-time method that uses techniques like raytracing or radiosity. This can be done in software like Kerkythea, Luxrender, Maxwell, Indigo, etc. These engines simulate the physics of light to achieve near perfect photorealistic renderings.

This article presents an exporter that converts a WPF 3D model to the XML format used by the Kerkythea render engine.

The source code is also located at Codeplex, and I hope other developers would like to contribute to make the exporter complete.

WPF Rendering

The test model consists of four spheres and a checkerboard (a typical raytracing demo scene). with one spot light and two directional lights.

Image 1


This is the raytracing output from Kerkythea. I used diffuse materials ("Whitted materials" in Kerkythea) with reflections turned on for both the spheres and the checkerboard.

Image 2

Metropolis Light Transport

The same model rendered using the metropolis light transport algorithm.

Image 3


Ray tracing - Photon map - Metropolis light transport:

Image 4

Using the Code

The WPF3D model can be exported from a Viewport3D control by the following code:

KerkytheaExporter exporter = new KerkytheaExporter(file);
exporter.BackgroundColor = Colors.Black;
exporter.Width = 1920;
exporter.Height = 1200;
exporter.Reflections = true;
exporter.Shadows = true;
exporter.SoftShadows = true;

This will traverse the scene graph, find all the light sources and use the current camera of the Viewport3D.


  • The Media3D.ModelUIElement3D class is sealed. A new base class was created for the elements used in this scene.

Future Enhancements

  • Support texture materials (it already exports texture coordinates)
  • The scene graph traversal may be improved with LogicalTreeHelper?
  • Unit tests



  • 2009-07-10: First post


This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)

Written By
Norway Norway
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

GeneralMy vote of 1 Pin
Hezoucky20-Oct-14 19:45
Hezoucky20-Oct-14 19:45 
QuestionThanks Pin
zhujinlong1984091316-Aug-11 21:10
zhujinlong1984091316-Aug-11 21:10 
AnswerRe: Thanks Pin
objo17-Aug-11 3:09
objo17-Aug-11 3:09 
GeneralWPF Transformations Pin
pittaman2-Feb-10 3:31
pittaman2-Feb-10 3:31 
GeneralRe: WPF Transformations Pin
objo2-Feb-10 3:42
objo2-Feb-10 3:42 
GeneralAnimation Pin
andre1234513-Jul-09 1:07
andre1234513-Jul-09 1:07 
GeneralRe: Animation Pin
tobywf13-Jul-09 21:51
tobywf13-Jul-09 21:51 
GeneralRe: Animation Pin
andre1234514-Jul-09 1:01
andre1234514-Jul-09 1:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.