Search Unity

how to support multiple displays UWP

Discussion in 'Windows' started by darkmax, Aug 15, 2016.

  1. darkmax

    darkmax

    Joined:
    Feb 21, 2012
    Posts:
    77
    I need to develop an augmented reality application using vuforia, and now that it supports UWP I think is possible to use this library for a windows pc application, but when I change my unity project for windows store on build settings I notice that multiple displays support doesn't appear to be found. My application needs to be displayed on two monitors where on one monitor is the augmented content and on the other is some kind of gui interaction.

    So my question is how can I support multiple displays in UWP
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    7,205
    Unfortunately there is no built in way.

    You could theoretically create a new CoreApplicationView, create a new swapchain for that, render all your stuff of the second monitor to a render texture in Unity, then call GetNativeTexturePtr on it and then blit it to the second window swapchain.

    I haven't tried this, though.
     
  3. darkmax

    darkmax

    Joined:
    Feb 21, 2012
    Posts:
    77
    Ok, It is sad that this can't be done in a built in way, I will try the other method that you mention, just I need to investigate a little further on how to do what you mention.
    Thanks for the tip.
     
  4. snw

    snw

    Joined:
    Mar 13, 2014
    Posts:
    41
  5. darkmax

    darkmax

    Joined:
    Feb 21, 2012
    Posts:
    77
    Last edited: Aug 17, 2016
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    7,205
  7. darkmax

    darkmax

    Joined:
    Feb 21, 2012
    Posts:
    77
    I'm trying to use this as example http://www.informit.com/articles/article.aspx?p=2304072&seqNum=2 but without success.

    On the MainPage.xaml.cs file I'm trying to implement this like on the link mention, but I don't know how to pass the texture of the camera to this new window. Maybe I'm doing this wrong, maybe I need to compile first a plugin with this new windows and then on unity import it and pass the texture to a method that has this new window.

    But I'm not sure how to proceed, I tried to search on the web for examples and tips but without success.
     
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    7,205
  9. darkmax

    darkmax

    Joined:
    Feb 21, 2012
    Posts:
    77
    ok, thanks I will check the links you provide.
    This is the first time I try to develop a plugin for unity, so it will be a little challenging but I hope is not that hard.
     
  10. EyePD

    EyePD

    Joined:
    Feb 26, 2016
    Posts:
    57
  11. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    246
    Any luck with this?

    We're trying to achieve something similar using UWP and clever graphics API tricks to Run a single unity instance against a number of windows.

    Edit: Research is ongoing but looking promising. Currently working on resource sharing between the Unity Direct3D Device and the Windows Direct3D Device. Should be possible in theory.
     
    Last edited: Mar 6, 2020
    EyePD likes this.
  12. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    246
    Solved for me, I bought and used this plugin:
    https://www.republicofhandball.com/assets/

    Long and short of it, this is a native C++ plugin which does the following:
    - Hooks into Unity's rendering thread with callback events: https://docs.unity3d.com/Manual/NativePluginInterface.html
    - Creates a regular window: https://docs.microsoft.com/en-us/windows/win32/learnwin32/learn-to-program-for-windows
    - Creates a new graphics device (Direct3D11 or OpenGL) and copies the output of a camera's render texture to the graphic device, outputting it to the new window
     
  13. EyePD

    EyePD

    Joined:
    Feb 26, 2016
    Posts:
    57
    I'm already using a native rendering plugin in my application and I'm not sure there's any way to insure the order of the plugin callbacks but perhaps it's just simply FIFO based on the order of the GL.IssuePluginEvent calls?
     
unityunity