SteamVR + 5.61 = "GL.End requires material.SetPass before!"

I’m getting an issue (reproduced by 2 other devs on 2 other projects) where if I have a project with the SteamVR plugin in, I get the error “GL.End requires material.SetPass before!” spammed to the console and the scene’s image is quite blurry.

I disabled the SteamVR cam, dropped in a basic Unity camera to use native Unity VR support and the the error and blurry image went away.

Any ideas what might be causing this / potential fixes?

1 Like

I ran into the same issue. It seems to be an issue with the camera’s CameraClearFlags, setting it to
CameraClearFlags.Nothing produces the error. Whenever certain steamvr components are used a [SteamVR] gameobject will be instantiated with a poseUpdater sub object that contains a SteamVR_UpdatePoses component.
In the SteamVR_UpdatePoses Awake method it creates a new camera and sets it’s clear flags to CameraClearFlags.Nothing. So just comment it out of the SteamVR_UpdatePoses Awakes method e.g.:

// camera.clearFlags = CameraClearFlags.Nothing;

Changing the clear flags of the camera fixes the crash, but I also noticed that the camera wasn’t using MSAA. removing the camera that gets instantiated in SteamVR_UpdatePoses Awake method stops Unity from rendering with this camera. Everything else seems to work fine without it and i couldn’t find any references to it so it should be safe to remove.

I reported this one yesterday, mainly because the error message wasn’t helpful.
I’ll apply your change sgsrules, thanks for the insight.

Looks like I was mistaken, the camera component in poseUpdater is needed to update the controller poses so don’t remove it.

Yes I experienced the same thing. I had upgraded to 5.6 so I could (hopefully) work again. With my 5.5f3 project Unity has decided to hang every 3 minutes or so. It’s not crashing…just hanging. I’m not sure how to troubleshoot this.

I have the same error:

GL.End requires material.SetPass before!

Read my first comment for a solution

sgsrules, your suggestion gets ride of the error message, but at least for me, the image is still very blurry and low-resolution. Everything is very blocky looking as if it’s only rendering things at 1/8th of the normal resolution. It seems that 5.6 has a few different issues with SteamVR.

That’s because it’s rendering using the new camera it generated. I managed to get everything working using my regular camera with all it’s scripts by doing the following:

  1. in SteamVR_Render.cs Update Method remove or comment out the following (lines 319-324) :
if (poseUpdater == null)
{
     var go = new GameObject("poseUpdater");
     go.transform.parent = transform;
     poseUpdater = go.AddComponent<SteamVR_UpdatePoses>();
}
  1. in SteamVR_UpdatePoses.cs remove the Awake method:
void Awake()
{
      var camera = GetComponent<Camera>();
      camera.stereoTargetEye = StereoTargetEyeMask.None;
      camera.clearFlags = CameraClearFlags.Nothing;
      camera.useOcclusionCulling = false;
      camera.cullingMask = 0;
      camera.depth = -9999;
}
  1. Add a SteamVR_UpdatePoses component to your main camera.

Steps 1 and 2 will prevent SteamVR from creating the extra dummy camera that it defaults to for some reason. Step 3 adds a necessary component so that the controllers and HMD are properly tracked.

I’m not sure if i should fill out a bug report for this issue since it affects SteamVR.

2 Likes

^Confirmed solution. Nice Job +1

@sgsrules : In the most recent version of SteamVR on the asset store, version 1.1.1 from July 28, 2016, the part you say is in SteamVR_Settings.cs is actually in SteamVR_Render.cs. Are you on a different version, or did you actually mean SteamVR_Render.cs?

Well done! This worked for me.

Yes, you’re right it’s actually SteamVR_Render.cs, i was looking at the wrong tab. Fixed the directions.

@sgsrules Thanks! This solution worked perfectly. It’s important to note that step 3’s main camera is the “Camera (eye)” in my case because I’m using the example VRTK + Steam VR set up. Not sure if anyone is using their own set up. But thought I’d share just in case.

I got around to trying this again, and it did clear up the low-resolution error. But:

  1. The camera is now not rendering things closer than 1.5 from the camera (I understand this is configurable, but an upgrade shouldn’t cause the camera to behave differently)
  2. Beautify asset not working
  3. My Highlighting asset is also not working.

Guess I’ll keep using 5.5f3 for now.

I just tried these changes with a new Unity project, imported the SteamVR package, opened the example scene. It didn’t work until I made the changes above.

However, I’m not seeing the Oculus Touch. They appear, and I can see all the buttons, and even see a few moving that I can see directly, but the controllers don’t move or rotate in tracked space. Any ideas?

Graeme

I tried sgsrules’ solution for 5.6 and it kind of worked, but in the throw-object-example-scene one controller is weirdly displaced…
EDIT:Nevermind, the same bug is in 5.5 without me changing anything in SteamVR
I gather from this thread that support is coming, but the github repo also mentioned there didn’t work for me.

I don’t used steamvr, even don’t know what it is. But I have same error(GL.End…) in console continuously.

How to fix this? Thanks.

Could you please file a bug report with a minimal reproduction case and reply in here with the case #?