Take the 2-minute tour ×

I know WPF is more complex an flexible so could be thought to do more calculations. But since the rendering is done on the GPU, wouldn't it be faster than Winforms for the same application (functionally and visually)?

I mean when you are not running any games or heavy 3d rendering, the GPU isn't doing heavy work, right? Whereas the CPU is always busy.

Is this a valid assumption or is the GPU utilization of WPF a very minor operation in its pipeline?

EDIT: The application that I am interested is a 3d modeling and animation software, where you have 3d viewports to navigate and edit the scene, and objects inside the scene. But I want to use WPF because of its modern architecture, and it's from scratch.

EDIT2: Also for my purposes I will use DirectX hands down for the app itself because of the high end requirements of the software. As for people using lower end or computers without a dedicated GPU, that's OK since they aren't not in my primary customer area. Just like other high end 3d software for film and games, it will be understandable to require a powerful computer to fully benefit from the application.

share|improve this question
It depends on the applications. –  SLaks Mar 26 '10 at 18:12
Sorry should add more detail then. –  Joan Venge Mar 26 '10 at 18:13
I'm no expert, but I believe the exact hardware (and corresponding drivers) may have a significant influence on performance as well. –  Daniel Pryden Mar 26 '10 at 18:15
you should also not that not all computers have a GPU some just have a simulated that runs on the CPU/Chip-set... –  Peter Mar 26 '10 at 18:15
add comment

5 Answers

up vote 13 down vote accepted

Provided the machine has a GPU, you'll get better rendering performance in WPF.

We have a large desktop application that we wrote in WinForms, and are now porting to WPF. We've witnessed much better rendering performance, particularly when resizing windows or redrawing controls.

We've also found that WPF "controls" are more lightweight than WinForm controls. If I recall right, WPF controls do not necessarily require an operating system handle, and don't register for Windows window messages via WndProc, at least not independently.

For your case, since you're building a 3d modeling app, which kind of assumes some 3d hardware on the machine, you should absolutely use WPF over WinForms.

share|improve this answer
Thanks, also since WPF also uses the GPU, would there be a fight between the application and WPT itself in utilizing that resource? –  Joan Venge Mar 26 '10 at 18:30
Not any more than it would if you did your own 2d menu system on top of your 3d app. In fact, WPF will probably do it more efficiently. :) –  Robert P Mar 26 '10 at 18:38
add comment

For the app scenario you describe, I would expect WPF to outperform WinForms for 3D work on a full featured GPU by a wide margin.

The difference between the application types is more than just the rendering the 3D vector pipeline. WPF's internal architecture is radically different than WinForms, specifically designed to overcome the caveats learned from years of prior experience with the Windows GDI and WinForms apps.

(WinForms is a relatively thin wrapper around Windows GDI and User model that was originally created in the late 1980's. The Windows User control model has evolved over the past 25 years, but the core architectural patterns are largely unchanged.)

For example, WPF always separates UI rendering from application logic. When the WPF window goes to draw something, the actual rendering happens on a background thread. The refreshed visuals are flipped to the display during the video retrace interval, so you don't get partial blits or "tearing" artifacts on screen.

WinForms does none of this. If you render to DirectX or OpenGL surfaces in a WinForms app, you have to do the work of flipping the video page and making sure it happens at the right time to avoid screen tearing artifacts.

Wpf's default controls are GPU aware and can be custom styled with glows and transparency and whatnot all GPU accelerated. WinForms controls do not benefit significantly from GPU features, since about the only things WinForms (Windows User controls) uses for rendering are 2D bitblit and rectangle fill. Glows, transparency, animations are all possible with WinForms, but you have to do all the work to implement them.

In WPF, UI slickness is mostly a matter of designing and styling to get WPF to do it for you. In WinForms, you have to push the pixels yourself.

share|improve this answer
Three is at least one tiny, but nasty thing with WPF on Windows XP. This is solved in Vista and up, so it bites people using an embedded version of Windows (there is no RTM of that beyond XP). The artifact is loosing vertical sync when doing high contrast animations, even something like playing a high contrast MPEG file. –  Jeroen Wiert Pluimers Apr 3 '10 at 10:33
If you have to support WinXP or earlier, I wouldn't recommend using WPF anyway. Just because the framework can technically execute there doesn't mean it will work well. ;> –  dthorpe Nov 8 '11 at 23:47
Back then, there was no Windows Vista Embedded, only Windows XP Embedded :) Windows 7 Embedded came years later... –  Jeroen Wiert Pluimers Nov 9 '11 at 14:09
add comment

This is a really tough question to answer.

A huge portion of WPF performance is your GPU. A good GPU works wonders for making WPF perform well. WPF can be very performant. If your requirements are to have a decent GPU, since it's a 3D modeling program, you'll probably find WPF performance to be as good or better than Windows Forms - though this really depends on what you're using.

That being said, it's usually difficult to compare - mostly because WPF allows you to add a lot of visual effects that people tend to never even attempt in Windows Forms. Many WPF applications "seem" faster even though they're actually slower in some instances because of extra visual clues.

That being said, if you have a LOT of controls, WPF can actually outperform Windows Forms by a fair amount. In Windows Forms, each control requires a separate window handle, and receives its own message sets. With a lot of controls, this can actually slow things down pretty dramatically.

The real question here should be is WPF perf. "good enough" for your application. If you're doing a 3D modeling application, chances are WPF will not be your bottleneck- it should be fine.

share|improve this answer
Thanks, what's the overhead of requiring a separate window handle that's happening in Winforms? Also since WPF also uses the GPU, would there be a fight between the application and WPT itself in utilizing that resource? –  Joan Venge Mar 26 '10 at 18:29
@Joan: Each window handle has to receive separate messages through the message pump. If you make a screen with hundreds of controls, it really lags badly in Windows Forms - especially if custom rendering is required. As for "fighting" - not really. Remember, Vista + W7 use the graphics card for ALL of your desktop rendering - modern GPUs are pretty good at handling this. I do sci. software/3d modeling, and use WPF exclusively for our new products, and love the perf. –  Reed Copsey Mar 26 '10 at 18:38
Thanks Reed. Good thinking. Also are your apps available online? Was wondering it would be cool to just see a screenshot even :O –  Joan Venge Mar 26 '10 at 18:47
@Joan: None of the WPF apps. Some of our (older) code is available online at my company's website - which does good 3D and math, but not a modern UI... –  Reed Copsey Mar 26 '10 at 18:48
add comment

For 3D modeling, WPF is clearly a lot better choice than WinForms -- but it's still a long ways from ideal. Winforms has no (direct) support for 3D rendering at all, and WPF has some. For a program that's aimed primarily toward 3D rendering, however, you might be better off with something dedicated more specifically to 3D rendering tasks, such as OpenGL or Direct3D.

On their own, neither of those provides a huge advantage over WPF, but unless what you're doing is fairly specialized, I wouldn't use those directly though. I'd use something like OpenSceneGraph or Ogre3D, that can use either of those for its rendering, but provides a much higher-level interface and does more to manage rendering your scene.

Either or both of these probably could use WPF for the actual drawing -- but I'm pretty sure neither one does, at least currently. I don't know whether they ever will either -- they might, but I doubt it's a real priority, since they already support OpenGL and Direct3D. For their purposes WPF provides little advantage.

share|improve this answer
Thanks, yeah it's a fairly specialized app in the way it handles things. Right now I only want to support Windows, so will stick to DirectX. I know WPF has 3d functionality but I don't think it's something to compete with DirectX itself if I am not wrong. But all the UI, etc I plan to use WPF. –  Joan Venge Mar 26 '10 at 18:41
While OpenGL is also portable, the main reason to prefer it over DirextX is that simply so much nicer to work with. –  Jerry Coffin Mar 26 '10 at 19:59
add comment

Seeing as WPF actually uses DirectX under the hood and the fact that you use XAML to specify DirectX objects, WPF is by far the easiest solution.

Example coding a camera in xaml:

<PerspectiveCamera x:Key="Camera"
 Position="0, 0, 4"
 LookDirection="0, 0, -4"
 UpDirection="0, 1, 0"
share|improve this answer
Thanks, so you mean I can access the whole DirectX SDK using XAML? I was planing to use SlimDX for the 3d stuff. –  Joan Venge Mar 26 '10 at 18:42
I don't know to what extent you can access... although I think that the WPF directX implementation is more for interface. SlimDX would still be the way to go for the 3D stuff. The benefit of WPF though is that since it is all DirectX, your interface and 3D stuff should be pretty seamless –  jle Mar 26 '10 at 18:59
Thanks, that makes of sense. –  Joan Venge Mar 26 '10 at 19:11
A word of warning: although I've found the WPF 3D stuff to be great, there is no good way to actually render 3D content to a bitmap, so if you'd need to export your 3D scenes, I'd go with SlimDX for the 3D portion. See stackoverflow.com/questions/2179042/… for more info. –  Groky Jul 13 '10 at 20:15
add comment

Your Answer


