WPF and DirectX and what's possible

I'm curious if anyone has a link detailing exactly what you can and cannot do in WPF vs DirectX.

For example:

If WPF is a thin wrapper over DirectX and I don't find what I'm looking for, will I be able to access the DirectX COM interface and get access to what I need

and:

I assume shaders aren't supported in WPF, so again, will I be able to hook up the plumbing for shaders, or will WPF have the same fate as the fixed-function pipeline (Where the shading algorithms are fixed making it difficult to create unique looking 3D.) Is 3D in WPF going to be restricted to diffuse/specular lighting


Regards.




Answer this question

WPF and DirectX and what's possible

  • DanPortugal

    I just want to make sure I am understanding correctly. What you are saying is...

    You can not have a WPF widget on top of your own DirectX context.

    If that is the case I hope that this is going to be resolved in the very near future. This is a very important issue for anyone looking to use WPF in a game. If the WPF 3D capabilities allowed you to use your own shaders, that would be one thing, but allowing neither is completely crippling for WPF in game-development.

    WPF team. Please do not make the same mistakes that Sun made with Java in not understanding the importance that game development brings to a platform.


  • Abhijit Das

    I develop multimedia players for kiosks. The Pcs that we use have multiple sound cards in them so that different media can be played to different areas within the premises. Is there any way that I can achieve this using wpf. I currently use directx and i can select the device or use graphedit to achieve what i want. However I am switching over to WPF because its absolutley fantastic so need a solution in wpf.
  • Vaughn Washington

    Being a Java Dev and actively drooling over WPF on a daily basis... I cant help but say, WPF is a HUGE HUGE HUGE leap forward from Java in terms of UI Capabilities! Huge!! Java UI (AWT/Swing) is stone-age technology when compared to WPF. Nothing like WPF has ever been done before that I am aware of. I really feel it's going to completely connect designers to application UI development and bring about a dramatic shift in how applications appear and behave. I think it's going to really raise the bar in terms of what will pass as a commercial quality application in 3 - 5 years (as far as the masses are concerned, i'm sure early adopters will have that feeling far before that).

    WPF has actually changed the way I view the world. I found myself at the movies this weekend taking small notes whenever they panned, zoomed or blurred and thinking to myself, in what ways could I use an effect like that in an Application What situations would it be applicable for What kinds of Applications would benefit from it   How should it be integrated so that it retains an element of subtlety and doesnt look blatant or deliberate I think theres going to be a lot of trailblazing over the next two years. The answers so far seem to be far and few between but, i've noticed my bookshelf and reading list slowly filling up with titles on Design, Motion Graphics, and Motion Pictures.

    If anyone else is interested in these topics... feel free to connect with me: briancabbott@gmail.com.

    Cheers,

    Brian Abbott
     

  • Mark Lu

     break_r wrote:
    I'm curious if anyone has a link detailing exactly what you can and cannot do in WPF vs DirectX.
     
    They are two different things.  WPF is made for designers to create vector-based applications using XML and managed code.  It uses DirectX as the rendering engine under the covers.
     
    DirectX is a set of APIs that abstracts access to modern graphics rendering hardware, as well as other technologies such as sound or input devices.
     
    WPF is not designed for any significant game programming, other than, say, a simple card came.  Nor is it designed with the intention of allowing you to create a 3D user interface into your DirectX game.
     
    If you want to integrate DirectX and WPF applications, you might want to read this article from Nick Kramer.  But bear in mind a couple of important points:
    1) The article uses an older version of WPF. But I believe the concept is still valid (use of HWNDs for integration)
    2) The limitations on integrating DirectX and WPF applications are extremely severe. 
     
    In a nutshell: we do not recommend the usage of WPF in the context of a DirectX application, for a variety of reasons. 
     


  • DBass63

    MS has stated that because the DirectX context is shared between multiple WPF contexts it will not support shaders in v1.0, nor will DirectX features be exposed from WPF.  You can have a DirectX context visible within a WPF window however.  But, that DirectX area creates a hole that WPF would not be able to display onto (as an overlay for example).

  • PaulTDessci

    David, I can't find the article from Nick Kramer that you're referring to. The link seems to have expired. Are you able to locate it in its current location

    Thanks!



  • Komayo

    I went ahead and tried it myself. I combined the Tutorial1 sample from the DirectX Dec CTP and the WindowsFormsHostingAvalonControl sample from the Windows SDK v1.0.

    I've confirmed that it does work as MichaelLatta said above. A screenshot of the result is here:

    http://www.z425.com/photos/directxformsandwpf.png

    The DirectX context is the blue part.
    The background image is what is set on the form.
    The top-left box contains WPF, everything else is on the form.

    Not good.

    I can understand why you can't use your own shaders in WPF. That would make it very difficult for it to do the compositing since it needs those shaders to do it. However. I don't understand why the overlay case is not trivially possible.

    I am going to try hosting WPF on top of Win32 and see what happens just for fun. I'll report back if it works.


  • Mick Seymour

    Oops. I meant top-right box is the WPF.

    (I would of just edited the post, but for "some reason" firefox does not work on this forum)

  • WPF and DirectX and what's possible