Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

URP in HoloLens app changes perspective of camera in game view

Discussion in 'Universal Render Pipeline' started by chris_gsa, Apr 23, 2020.

  1. chris_gsa

    chris_gsa

    Joined:
    Aug 1, 2019
    Posts:
    9
    Hi!

    I created a new Unity 2019.3.10f1 project for HoloLens, added MRTK 2.3.0, place a cube in the scene, and when I hit "Play" everything renders just fine in the Game view:
    upload_2020-4-23_13-12-26.png

    As soon as I change my to URP in Project Settings -> Graphics -> Scriptable Render Pipeline Settings, update the shader of the cube and hit "Play" again, the cube suddenly gets rendered from a very different perspective:
    upload_2020-4-23_13-14-47.png

    I can move the camera around with WASD and I see that the diagnostics object of MRTK is moving with it, however, I can not get any closer. It seems like the scene is not rendered from my main camera but from somewhere else instead. I tried to play around with the URP settings, but did not find a solution. How can I configure URP to work for my scenario?

    I found a similar question in the MRTK forums but there they state this is not an issue of MRTK:
    https://github.com/microsoft/MixedRealityToolkit-Unity/issues/6181

    Thank you!
     
  2. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    839
    Which shader are you using when you update it on the cube?
     
  3. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    839
    And which hololens device is this?
     
  4. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    839
    I just created a simple scene in a new project with URP and MRTK 2.3.0. Default setup of MRTK, and I let MRTK configure my new scene. All I did was then create a new cube (which already had the URP shader applied) and build that out to a VS Project. From there I build out the application for HL1, deployed and ran and everything seems to be just fine.

    If you have a simple project that reproduces this issue I'd be happy to look at it.
     
    ThomasZeng likes this.
  5. chris_gsa

    chris_gsa

    Joined:
    Aug 1, 2019
    Posts:
    9
    Hi!
    Thank you for your reply. This is for HoloLens1 and I am using a MRTK standard shader, upgraded to LWRP. On the device itself it worked correctly, but not in Unity Play mode, which was annoying because I wanted to create and test a user interface.

    Still not exactly sure what the problem was, but I found a solution. My project still used the built-in XR settings in Project Settings -> Player -> XR Settings. Once I installed the XR Plug-in Manager and added the Windows Mixed Reality Plug-in Provider with default settings, the issue went away.
     
  6. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    839
    So this was broken in play mode only, and not even in remoting?
     
  7. chris_gsa

    chris_gsa

    Joined:
    Aug 1, 2019
    Posts:
    9
    Sorry, I did not try in remoting initially. Unfortunately, since I added the XR Plug-in Manager & WMR Plugin, the remoting stopped working altogether.
     
  8. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    839
    Are you trying to use the deprecated Holographic Emulation or the new XR WMR remoting window to connect and run?

    Since I can't repro given your description, I'll need a simple repro project from you so I can see what it is I am missing or not doing to repro the issue. If you like, you can also file a bug, just please post the bug ID here so I can find it quickly.
     
  9. chris_gsa

    chris_gsa

    Joined:
    Aug 1, 2019
    Posts:
    9
    I uploaded a minimal example here:
    https://drive.google.com/file/d/1V7M8c2E3QGR4uHIsoQYRxT9Sv7620yEE/view?usp=sharing

    Steps to reproduce:
    1. Create new project with Unity 2019.3.10f1
    2. Import MRTK 2.3.0 unitypackage
    3. Switch to Universal Windows Platform in Build Settings
    4. Go to Mixed Reality Toolkit -> Add to Scene and Configure...
    5. Go to Project Settings -> Player -> XR Settings and add Windows Mixed Reality SDK
    6. Place a cube in front of the camera and attach a MRTK standard shader
    7. Install Universal RP through Package Manager
    8. Add a UniversalRenderPipelineAsset to the Scene
    9. Go to Project Settings -> Graphics and set UniversalRenderPipelineAsset as Sctiptable Render Pipeline Settings
    10. Got to Mixed Reality Toolkit -> Utilities -> Upgrade MRTK Standard Shaders for LWRP
    When entering Play mode, the Cube gets now rendered from a strange perspective (see screenshot above). In Remoting, the cube gets rendered normally.

    After that I upgraded the Project to the new XR WMR PlugIn by installing XR Plug-in Management and adding the WMR Plugin. Now:
    So I guess the only thing I can do now is roll back to the deprecated XR settings and test / debug my UI in remoting while waiting for a fix...
     
  10. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    839
    You need to add a Tracked Pose Driver to the camera to make it tack when using XR SDK.

    Can you repro the same issue without MRTK? I.e. if you create a new project, add URP and add a cube with a URP shader does it do the same thing? Just trying to remove variables here if possible.
     
  11. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    839
    What you are seeing is not a warping, but an artifact of the MRP simulator state coupled with the MRTK environment. MRTK is inserting a "floor" into the scene at runtime, which is being positioned at a point where it thinks the floor should be. The floor is being positioned at 0,0,0, which happens to be where the cube is being rendered, so it cuts the cube in half, occludes the bottom portion and so you see the top portion of the cube as "squashed".

    This only happens in simulator and not in headset or other device, which leads me to believe that there is something about the simulator that is causing things to be incorrect for some reason (like world data coming form WMR).

    The quickest thing would be to move your cube so that it is above the MRTK floor for simulator testing.

    As for movement, it took me a while to figure out that you were using WASD while focused on the MRP window and not Unity. Even with that I can't repro the movement issue you are seeing. When I move around in the simulator window I am able to move to and from the cube correctly.


    upload_2020-4-28_13-49-29.png
     
  12. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    839
  13. chris_gsa

    chris_gsa

    Joined:
    Aug 1, 2019
    Posts:
    9
    yes, this is exactly the issue I am hitting. Thank you, I upvoted and commented on the issue.

    The problem here was that I used a custom camera profile which was missing the GenericXRSDKCameraSettings provider. After adding it, it works now.
     
  14. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    839
    Good to hear, thanks!
     
unityunity