Is WPF 3D good alternate of DirectX and OpenGL for complex applications?

SpeedBirdNine picture SpeedBirdNine · Jan 20, 2012 · Viewed 31.7k times · Source

I have used WPF's 3D capabilities for learning, and for a few implementations, and I have found it to be very capable, and I am also learning DirectX 11, and it is very tricky compared to using 3D classes in WPF. I have only used WPF 3D for very basic stuff, my question is:

Is WPF 3D equally good for advanced applications such as 3D modelling tools, game engines and 3D simulations etc to be an alternative to DirectX and OpenGL?

If there is anything else in the same league, please mention it too.

Answer

Dr. Andrew Burnett-Thompson picture Dr. Andrew Burnett-Thompson · Jan 20, 2012

Good question. The answer is it depends!!

On a more useful note I can say this: A few years ago I developed a CAD-style 3D rendering application in OpenGL. This had to display CAD models of oil rigs with up to 1,000,000 objects and allow the user to zoom right in to detail, or zoom out, move objects etc... I can say with some certainty that WPF wouldn't be suitable for this type of application as it would just be too slow. This application was developed using C++/CLI and bridged from a .NET GUI (Toolbar, window) to C++ to OpenGL (render surface) and even that introduced a performance hit over a native C++/OpenGL application due to thunking. So, if you want the highest performance, you cannot beat native C++ with DirectX or OpenGL.

WPF can provide high performance 3D graphics and smooth interactivity for simpler 3D applications. For instance, a 3D chart surface or a 3D carousel, even a 3D CAD model viewer so long as the model was fairly simple. Once the object count starts to ramp up you will notice the rendering engine can't handle it - that's when you need to switch to a rendering engine that allows direct access to the GPU.

For a halfway house solution (managed + DirectX), try SharpDX. This is basically an open source implementation of Managed DirectX and is extremely powerful and versatile. The performance hit of managed vs. native C++ is minor (~5%) and when done right, managed DirectX can be extremely performant.

Something we've done is integrate DirectX directly with WPF via D3DImage. We've achieved this in a WPF 3D Chart Control which uses DirectX11 for the drawing (not WPF3D). This shares directly from native DirectX to WPF but you can get equally good results with SharpDX, which we've used to create a high speed WPF Drawing Plugin here.

For a showcase of WPF3D I suggest you try this link. As you notice WPF3D can make extremely visually appealling and sometimes complex examples but you won't find any 1,000,000 object oil rigs in there ;)

Finally, what is it that you wanted to do in WPF 3D? Just a point of interest or do you have a specific project to implement and want to know if it would be suitable?

Best regards,