Uncategorized

Resolving Unity Issues with Lighting and Mesh Distortion in Virtual Reality

I recently encountered an unusual issue with Unity 2018.3 and SteamVR 2.20 where light would cause meshes to distort.

It is hard to explain, as it would happen anytime a light would hit a surface, and only for the first few frames.  But because it was a unique problem, I wanted to make sure to post a solution somewhere.

Edit:  Added two more causes & solutions that I’ve encountered over the last few months

Like many unusual Unity issues, the problem may only happen on-device.  The Unity Editor view, and the Preview in Steam VR, likely will both show a clean view of the model or scene.  And in the actual headset, you see what looks like screen tearing and mesh tearing on the models.

Cause #1: Post Processing FX

This is a real challenge, as the project I am currently working on has significant lighting due to fire.

Anyways, without going into great depth – what I did to fix it was create a brand new project to experiment with – and slowly bring everything in one at a time.  Eventually, the issue for me was being caused by a strange setting with Post-Processing Layers.  Even though they were configured properly, and even empty for the profile – it still would cause the issue.

To fix this, I removed both the Post Processing Layer, and the Post Processing Volume, and then reseting the camera Layer to put it in a fresh state.  Reverse the process, re-added them, add the post-processing layer to the Post Processing Layer first, and then assign it to the Camera.  For some strange reason, this is all it took to resolve the issue in the currently active scene.  But given the messy problems with the new prefab system, you may find you need to remove and re-add the post processing stack in each scene.

Cause #2:  SteamVR’s Anti-distortion or Motion Smoothing

In some other cases, SteamVR’s new anti-distortion (intended to help smooth out bad FPS projects) can also cause similar interference.

Open Steam VR

Select Menu > Settings

And on the Developer panel, uncheck Enable advanced supersampling filtering

And for testing purposes, you can also go into Applications > Motion Smoothing and set it to Always disable

If this is causing issues, it could be caused by the application lagging and impacting SteamVR.

Cause #3:  Amplify Shader for Unity

A third cause I’ve now seen, is the back-face culling in the Amplify Shader Editor for Unity.  This can cause unusual lighting issues, shadows and artifacting.  And has been causing issues for us working with the Oculus Quest specifically.

If you have used this to create your own custom shader, changing from Cull Mode ‘Back” to Cull Mode ‘None” may resolve the issue (at a cost of performance).

Find any other solutions to this problem?  Drop a comment below, and I’ll get it added to the above!

 

(1318)

2 thoughts on “Resolving Unity Issues with Lighting and Mesh Distortion in Virtual Reality

  1. Hi, I have the same problem… in editor all works fine, but in headset there are many distortions when I’m moving… I’ve tried to remove PostProcess from my scene, use a default scene (found in my assets and without postprocess) but there are distortion too… Do you know if an Unity version can remove this please?

    1. I’ve actually found two more reasons this can happen, so I’ve gone ahead and added them to the blog post. Give cause #2 a try!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.