google-ar / arcore-unity-sdk

ARCore SDK for Unity
https://developers.google.com/ar
Other
1.4k stars 401 forks source link

Negative scale causes camera feed to stop #258

Open oniskanen opened 6 years ago

oniskanen commented 6 years ago

This is a repost of #207 and #169, which were closed since there was no clear repro.

I took the HelloAR example and tried to convert it into a minimal repro, and it appears that an object with negative scale will mess up the rendering when the scene is lit by a Directional Light with Soft Shadows enabled. There's a repro project at https://ufile.io/cgtuh . The archive contains the Unity project, the .apk file for testing, a video capture of the bug and logs. The scene is called HelloAR-NegativeScale-SoftShadows and it contains the ARCore Device prefab, a Directional Light with Soft Shadows enabled and a default Unity Cube with a script attached. The script flips the cube's x-axis scale when tapping the screen.

Here's a screencap of the bug (the object should be a cube):

screenshot

Logs: Logcat grep "Unity" Full Logcat

The ARCore package is the 1.2.1 release, slightly modified as suggested in #199 and #196 to compile on IL2CPP and .NET4.6. I was able to reproduce the issue on Mono + .NET3.5 as well.

This happens (at least) with Samsung Galaxy S7 Edge (SM-G935F) running Android 8.0.0. App was built with Unity 2018.1.2f1 on macOS 10.13.5.

Let me know if you have difficulties reproducing the issue or find a workaround! Negative scales and shadows both are needed for the project I'm working on.

pablisho commented 6 years ago

Hi, thanks for the report. This information is super useful. We'll be doing some investigation about this issue.

somepablo commented 6 years ago

Same problem here, when shadows, directional lights and negative scales are combined the camera feed breaks.

Tested with ARCore 1.3 for Unity and several ARCore capable devices.

zeroregard commented 6 years ago

Is there any news on this issue? @pablisho

small-potatoes commented 6 years ago

Hi, we are still working with Unity to address this issue. A workaround can be devised by detecting negative scale in the background material shader and "correcting" it. We are focused on developing a long term solution with Unity.

corbinyo commented 6 years ago

Hi, we are still working with Unity to address this issue. A workaround can be devised by detecting negative scale in the background material shader and "correcting" it. We are focused on developing a long term solution with Unity.

Could you explain how to do this?

corbinyo commented 6 years ago

Has anyone found a solution to this?

small-potatoes commented 6 years ago

Hi @corbinyo , you should be able to add the line: Cull Off to this spot in the background shader as a workaround.

chaosemer commented 5 years ago

@Klipi, the link for the repro project seems to have expired. Could you please provide an updated link?

oniskanen commented 5 years ago

Here's a hopefully more permanent repro: https://github.com/Klipi/arcore-unity-issue-258

corbinyo commented 5 years ago

Hi @corbinyo , you should be able to add the line: Cull Off to this spot in the background shader as a workaround.

This does work as a workaround, thank you.

oniskanen commented 5 years ago

Hi @corbinyo , you should be able to add the line: Cull Off to this spot in the background shader as a workaround.

This does work as a workaround, thank you.

I can confirm that for our project the workaround is good.

CenekStrichel commented 5 years ago

Bug is still present in ARCore 1.5.0. Negative scale break camera clearing.

fredsa commented 5 years ago

As far as we can tell, this is a Unity issue and not an issue with the ARCore SDK for Unity.

Please use Unity's built-in bug reporting tool to report the issue directly to Unity. Once Unity has assigned a Unity case number, please list the case number here.

fredsa commented 5 years ago

Leaving this issue open for tracking purposes for now.