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!