Unity-Technologies / com.unity.perception

Perception toolkit for sim2real training and validation in Unity
Other
906 stars 174 forks source link

All the RGB images are flipped in Y axis #310

Closed wizardjo closed 2 years ago

wizardjo commented 3 years ago

Hi,

There is a some strange behaviour in the Unity Simulation Capture 0.0.10-preview.22 library. All the RGB images appears flipped in the Y axis. This error doesnt happend in Unity Simulation Capture 0.0.10-preview.21.

Thank you

mkamalza commented 3 years ago

Hi,

We have heard about this issue once before but have not been able to reproduce it yet. Can you please provide more information about your setup (Unity version, Perception package version, OS)?

Also, if possible, it would help if you could share your Unity project with us.

wizardjo commented 3 years ago

Hi @mkamalza

Unity version -> 2019.4.25f1 Perception package -> 0.8.0 preview.3 Simulation Capture -> 0.0.10 preview.22

mkamalza commented 3 years ago

Thank you. And is this on Windows? Also, are you using URP or HDRP?

wizardjo commented 3 years ago

Yes. Windows 10, using URP.

Note: When I created a build for Linux (to run in Unity Sim) the problems does not appear.

mkamalza commented 3 years ago

Thank you. I am now able to consistently reproduce this. It happens when in the camera settings, post processing is enabled and FXAA anti-aliasing is disabled. So as a temporary work-around, please enable FXAA. Meanwhile, we will be looking into this to fix it as soon as possible.

JonathanHUnity commented 2 years ago

The new 0.9.0 version of the package has a fix for this issue. Let us know if it does not work.

karthikm-0 commented 2 years ago

Sorry to bump this but I had the same issue with 0.10.0-preview.1 of the Perception package without using the Simulation package. This occurred regardless of whether post processing. Downgrading to 0.9.0-preview.2 fixed it for me. This was using Unity 2020.3.21f1 on Ubuntu.

JonathanHUnity commented 2 years ago

Thanks for the report. We are investigating.

jmacpereira commented 2 years ago

I'm having the same Y-flipping issue on the newest preview release, plus an additional issue which didn't happen on 0.9.0 and seems to be caused by the same change: the RGB image comes out darker than it should. This happens only when using OpenGL, switching to Vulkan fixes the darkness but not the Y-flipping:

Normal image rendered by a Camera, looks the same on OpenGL and Vulkan:

Image rendered by PerceptionCamera with OpenGL:

Image rendered by PerceptionCamera with Vulkan:

Using Unity 2020.3.31f1 on Ubuntu.

an99990 commented 2 years ago

same issue but enabling FXXA doesnt fix it for me.

JonathanHUnity commented 2 years ago

We are working on a fix. @jmacpereira this issue should go away if you switch your project to use Vulkan instead of OpenGL. Can you confirm that this works for you?

JonathanHUnity commented 2 years ago

Sorry, I just noticed that you have reproduced this on Vulkan as well. I have thus far not been able to reproduce this issue on Vulkan. If you have a project that you can provide, send us an email at computer-vision@unity3d.com and I will send you instructions on how to send it to us securely. Thank you!

jmacpereira commented 2 years ago

Hi Jonathan, thanks for the support. We've realized the y-flipping doesn't happen if the Camera targeted by PerceptionCamera doesn't have a targetTexture.

However, we need to set the camera resolution when it's created in code, so we're doing gameObject.GetComponent<Camera>().targetTexture = new RenderTexture(width, height, 0); and doing this causes the image to flip.

Also tried setting different RenderTextureFormats on the constructor, but none of them fixed the flipping, and some caused the same darkness problem as OpenGL.

I've sent an email explaining the bug and attached an example project to the address you mentioned. This project has no sensitive code / assets.

Thanks again

jmacpereira commented 2 years ago

Just updated to 0.11.1 and this is now fixed, both for OpenGL and Vulkan.

Thank you for the quick fix 🎉 I think this can be closed for now.

JonathanHUnity commented 2 years ago

Great! Thank you for confirming @jmacpereira