[URP] [XR] Some shapes are not working in Single-Pass Instanced

Avatar
  • updated
  • Fixed

When using Shapes in URP XR and with Single-Pass Instanced rendering activated, some shapes (lines) are properly drawn while others (for example disc) are not.

URP 10.1 / Unity 2020.2

Image 172


Left Eye | Right Eye

Image 170


It's actually quite a party

https://imgur.com/D1Utm5P

Reporting a bug? please specify Unity version:
2020.2.0b9
Reporting a bug? please specify Shapes version:
2.3.2
Reporting a bug? please specify Render Pipeline:
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Fixed

actually, it's fixed now for the next version :)
while unity_CameraToWorld is still broken, in my use cases I can use the inverse view matrix instead

Avatar
Anton Gavrilov

Have the same problem here with Unity 2020.2.1f1

Used to work on 2020.1.6, started breaking only after update. 

Avatar
Freya Holmér creator

I haven't really changed anything on my end with regards to this, it seems like it might be a Unity issue?

Avatar
Anton Gavrilov

Does indeed seem like something changed in Unity/URP, but might still be an easy fix on your end, I wouldn't know :)

Avatar
Freya Holmér creator

In googling for it I can't find anything about how it might have changed in those versions, so I'm not sure what I'd have to do different, everything is set up the way it should be as far as I know

I'd be curious to see if this happens to Unity's shaders too

Avatar
Anton Gavrilov
Quote from Freya Holmér

In googling for it I can't find anything about how it might have changed in those versions, so I'm not sure what I'd have to do different, everything is set up the way it should be as far as I know

I'd be curious to see if this happens to Unity's shaders too

So far everything else in our project seems to work

Avatar
blake gross

I'm seeing the same issue, Unity 2020.2, URP 10.2.2

Avatar
Freya Holmér creator

is there anything you can do on your end to narrow it down? (I don't have a VR headset to test this with)

Avatar
martin lizee

Same issue, using Oculus Quest 2, Unity 2020.2.5f1, URP 10.3.1, Shapes 3.0.0.

Tried modifying some shape settings but with no results.

Avatar
martin lizee

Hi, after looking at https://docs.unity3d.com/2020.2/Documentation/Manual/SinglePassStereoRendering.html, I looked at some of the code in Shapes and notice that for instance "Shapes Math.cginc" seem to some functions that could normally be used directly from UnityCG.cginc, functions like UnityWorldToClipPos, and maybe others. Maybe the new URP relies on the fact that some more of these functions (in UnityCG.cginc) are used, which could explain why other plugins seem unaffected by the new URP, but Shapes is.

Avatar
olleyOop

I have the same problem here.

Valve Index, Unity 2020.2.5f1, URP 10.3.1, Shapes 2.3.2 & 3.0.0

In the screenshot below you can see the shapes that are working

As soon as I turn on one of the others ( except Blend Modes & Stencil - they just don't appear ) it starts to flicker heavily.

I have a video as well.

https://www.dropbox.com/s/wload7m5hgoautb/LeapMotionVR%20-%20Shapes%20Gallery%20-%20PC%2C%20Mac%20%26%20Linux%20Standalone%20-%20Unity%202020.2.5f1_%20_DX11_%202021-02-24%2016-52-22.mp4?dl=0

Avatar
Freya Holmér creator

Have any of you been able to pinpoint more specifically, what shapes don't work vs which ones work fine?

Avatar
olleyOop
Quote from olleyOop

I have the same problem here.

Valve Index, Unity 2020.2.5f1, URP 10.3.1, Shapes 2.3.2 & 3.0.0

In the screenshot below you can see the shapes that are working

As soon as I turn on one of the others ( except Blend Modes & Stencil - they just don't appear ) it starts to flicker heavily.

I have a video as well.

https://www.dropbox.com/s/wload7m5hgoautb/LeapMotionVR%20-%20Shapes%20Gallery%20-%20PC%2C%20Mac%20%26%20Linux%20Standalone%20-%20Unity%202020.2.5f1_%20_DX11_%202021-02-24%2016-52-22.mp4?dl=0

1st screenshot here since it's not showing up ..

Avatar
Freya Holmér creator

super helpful, thanks a ton

Avatar
martin lizee

Hi Freya,

You can now actually test the singe pass stereo view without a headset using the Mock HMD XR Plugin: https://docs.unity3d.com/Packages/com.unity.xr.mock-hmd@1.0/manual/index.html.

I just tested it and, once you installed the plugin and then set the SinglePassInstanced rendering mode, then test it in play mode making sure you select Both Eyes for rendering, you get:

Avatar
martin lizee

Hi, were you able to reproduce the problem with the Mock HMD XR?

Avatar
Freya Holmér creator
Quote from martin lizee

Hi, were you able to reproduce the problem with the Mock HMD XR?

haven't been able to try it yet as I was wrapping up other fixes, and my attempts to get it up and running in 2018.x failed miserably, I think I'll need to test it out in 2019 but haven't had the time yet!

Avatar
martin lizee

Thanks, as I said, Shapes normally looks incredible in VR so can't wait to be able to use it again. I forgot to mention that the test I did with the Mock HMD XR using the URP was with Unity 2020.2.5f1.

Avatar
Freya Holmér creator

installing the mock HMD works in URP 2020.1.17f , but I now have a repro where it breaks in 2020.2. I couldn't find anything in the changelog related to single pass instanced shader changes, does anyone know what changed?

Avatar
Freya Holmér creator
  • Unity's Fault

it looks like Unity broke the camera to world matrix in 2020.2 because who knows why

2019:


2020.2, SRP VR single pass - the camera to world matrix is the identity matrix in the left eye, and a zero-matrix in the right:


I honestly don't know why or how to fix this, it seems to be on Unity unfortunately :(

Avatar
olleyOop

Not sure if it helps but I've noticed that there is an update on TextMeshPro with the following change:

  • Updated TMP Sprite shader to add support for Single Pass Stereo rendering.

https://docs.unity3d.com/Packages/com.unity.textmeshpro@3.0/changelog/CHANGELOG.html

Maybe the TMP guy can help?!

Avatar
Freya Holmér creator
  • Answer
  • Fixed

actually, it's fixed now for the next version :)
while unity_CameraToWorld is still broken, in my use cases I can use the inverse view matrix instead

Avatar
kenneth roecks
Any chance you would be willing to share some details on what you fixed?

I've seen this issue with a few different shaders I've downloaded and it would be awesome to have something to look for next time.
For instance, I'm pretty sure unity has broken their own terrain shader for URP / VR multiple times in this manner.
Avatar
olleyOop

I've tested it right now and it works.

Thanks!

Avatar
Freya Holmér creator
Quote from kenneth roecks
Any chance you would be willing to share some details on what you fixed?

I've seen this issue with a few different shaders I've downloaded and it would be awesome to have something to look for next time.
For instance, I'm pretty sure unity has broken their own terrain shader for URP / VR multiple times in this manner.

replacing all unity_CameraToWorld with UNITY_MATRIX_I_V

note that they aren't necessarily equivalent though, I think the Z axis direction might be flipped on some platforms, but for Shapes that didn't matter since I wasn't using Z anyway

Avatar
martin lizee

Just tried it, and it works great!

Thanks for fixing this, Shapes looks good on PC but it looks incredible in VR!