Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 533
SpeedBirdNine Avatar asked Jan 20 '12 12:01

SpeedBirdNine


People also ask

Does WPF use DirectX?

WPF uses DirectX and attempts to provide a consistent programming model for building applications.

Does WPF use OpenGL?

We can then directly draw the DIB bits to the WPF control. However, there is a serious limitation to this - drawing to a DIB is never hardware accelerated, it always uses the native OpenGL 1.1 drivers included with Windows. Not only is it not hardware accelerated, it also doesn't support any modern extensions.


2 Answers

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 into 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 appealing 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?

like image 121
Dr. Andrew Burnett-Thompson Avatar answered Sep 21 '22 12:09

Dr. Andrew Burnett-Thompson


There are two models of 3D Graphics: 1. Pipeline or infinite loop approach (3D Games, Hard level 3D Cad systems with 100.000 and more objects - meshes) 2. Smart abstract model WPF3D with classic support of OOP without any OnDraw, OnPaint methods. It is very important to use Media3D methods of WPF by right way. So most important thing is without any OnDraw, OnPaint.

You must analyze your application type and features and choose.

It is not so correct opinion about WPF 3D as for most simple application, but for full managed OOP objects. For example, take a look on screenshots on my site TIMO Structural CAE

It is full managed 3D WPF app.

like image 25
Sergey Orlov Avatar answered Sep 24 '22 12:09

Sergey Orlov