Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.04k stars 1.14k forks source link

[HowTo] stereoEnabled check in URP not working #1000

Closed Phantomxm2021 closed 1 year ago

Phantomxm2021 commented 2 years ago
  if(!m_CameraAR.stereoEnabled)

This code doesn't work in URP.

Phantomxm2021 commented 2 years ago

Any update for this problem?

DavidMohrhardt commented 2 years ago

This is a bug. Good catch.

For now you can work around the issue by querying whether or not the CameraData.xrRendering property is true when URP is enabled.

Phantomxm2021 commented 2 years ago

This is a bug. Good catch.

For now you can work around the issue by querying whether or not the CameraData.xrRendering property is true when URP is enabled.

Thank you for your reply. But How can I accessing the CameraData ?

WyattBUnity commented 1 year ago

So, looking into this, can you clarify what you mean by "doesn't work", is it a compile error, a runtime error, or does it not output correct values when querying?

Phantomxm2021 commented 1 year ago

So, looking into this, can you clarify what you mean by "doesn't work", is it a compile error, a runtime error, or does it not output correct values when querying?

Incorrect values when querying!

In URP m_CameraAR.stereoEnabled always return False .

WyattBUnity commented 1 year ago

Got it, I tested it on a project with later versions of unity, and I was able to get it to output true and false when using URP in VR and out of VR. Can you give me the unity editor version, arfoundation package version (check the package manager page) and what device are you trying to use with it?

Phantomxm2021 commented 1 year ago

Got it, I tested it on a project with later versions of unity, and I was able to get it to output true and false when using URP in VR and out of VR. Can you give me the unity editor version, arfoundation package version (check the package manager page) and what device are you trying to use with it?

Unity Version:2021.3.21f ARFoundation Version: 5.0.3 Device: mobile

WyattBUnity commented 1 year ago

Device: mobile

As in VR on the mobile device itself that requires it be placed in a headset chassis?

Phantomxm2021 commented 1 year ago

Device: mobile

As in VR on the mobile device itself that requires it be placed in a headset chassis?

No! ARFoundation is for AR not VR. When we use the mobile(iPhone -ARkit / Android - ARCore) to use ARFoundation 5.x version in URP, we need to use m_CameraAR.stereoEnabled to disable the CheckRenderLine.

WyattBUnity commented 1 year ago

I'm interested to know the situation that the camera will be rendering stereo while using the ar foundation package that's on a mobile device, without it being vr. If the stereoEnabled is always false, then you have confirmed that it returns false while it's rendering stereo vision on a mobile device as you stated, the details of the setup is what we need to know in order to reproduce the issue. Or, if possible, it would be helpful for us to have a project that is reproducing the issue with defined steps, in the case that it's too complicated to explain precisely how to get the bug to occur.

DavidMohrhardt commented 1 year ago

If the device is not being used to render a stereo VR image (IE you are not in a multipass or single pass instanced stereo rendering mode) then m_CameraAR.stereoEnabled always returning false is the correct behavior.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

andyb-unity commented 1 year ago

Closing this issue as asked and answered. Thanks @DavidMohrhardt! Feel free to re-open it if you have further questions.