mobfishgmbh / Cardboard-VR-Unity-SDK

Apache License 2.0
56 stars 11 forks source link

Unity Fog breaks VR View on Iphone 8 & Iphone 7 #79

Open AerinFloreo opened 4 years ago

AerinFloreo commented 4 years ago

Any scene that has fog is visually broken in the VR View on Iphone8 and Iphone7 (those are the two devices we have tested, anyway.) We have tested with Iphone 8+ and higher and it displays correctly on those generations of devices.

How it looks: IMG_0001 2

How it SHOULD look

Screen Shot 2020-10-21 at 2 08 21 PM

If I disable fog on CamLeft or CamRight, their respective viewport displays correctly (but without fog). I did this via RenderSettings.Fog = false in OnPreRender.

Cameras that are not using RenderTexture display correctly (such as the NoVRCamGroup).

cdytoby commented 4 years ago

Sorry for the late response. I investigated it and fog is an issue on iOS, there are other users reporting this but failed to find a solution.

I can reproduce this issue on iOS but not Android.

Currently I'm not able to find a solution. While continue searching the cause, I need help with this.

AerinFloreo commented 4 years ago

We successfully worked around it by turning the Left and Right camera into Physical Cameras (in the Camera Component). We also had to comment out this in RefreshCamera() since it overwrites the Camera settings:

RefreshCamera_Eye(leftCam, CardboardManager.projectionMatrixLeft, CardboardManager.eyeFromHeadMatrixLeft);
RefreshCamera_Eye(rightCam, CardboardManager.projectionMatrixRight, CardboardManager.eyeFromHeadMatrixRight);

Why did this work? No clue! But we have 0 visual errors now. (Other than the fog, we had strange problems that "looked like" Occlusion Culling and Clipping Plane issues, but they were not actually due to that.. things were clipping at the edges of the view port, objects being cut if you look at them at certain angles and distances, etc.)

cdytoby commented 4 years ago

RefreshCamera_Eye do refresh camera but it's also needed for correct cardboard eye position and projection matrix. I'll look into it if that works for you.

I also did a bug report on Unity, let's see what solution they can offer.

https://fogbugz.unity3d.com/default.asp?1290193_83aaleb4emcccfsd

AerinFloreo commented 4 years ago

RefreshCamera_Eye do refresh camera but it's also needed for correct cardboard eye position and projection matrix. I'll look into it if that works for you.

I also did a bug report on Unity, let's see what solution they can offer.

https://fogbugz.unity3d.com/default.asp?1290193_83aaleb4emcccfsd

Thank you, I appreciate it! We are doing OK on our end with the "hack" we came up with, but a more legitimate solution would be great too 😂

cdytoby commented 3 years ago

The unity guys keeps talking about the official cardboard plugin, and refuse to help in this subject, even I uploaded this project as a whole, not as a plugin.

Anyway, help is still wanted to solve this issue.