Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

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

Discussion in '5.6 Beta' started by JonDadley, Dec 14, 2016.

  1. JonDadley

    JonDadley

    Joined:
    Sep 2, 2013
    Posts:
    139
    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?
     
    NeilC likes this.
  2. sgsrules

    sgsrules

    Joined:
    Nov 11, 2013
    Posts:
    9
    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;
     
  3. sgsrules

    sgsrules

    Joined:
    Nov 11, 2013
    Posts:
    9
    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.
     
    Last edited: Dec 14, 2016
  4. 0xb1dd1e

    0xb1dd1e

    Joined:
    Dec 15, 2015
    Posts:
    1
    I reported this one yesterday, mainly because the error message wasn't helpful.
    I'll apply your change sgsrules, thanks for the insight.
     
  5. sgsrules

    sgsrules

    Joined:
    Nov 11, 2013
    Posts:
    9
    Looks like I was mistaken, the camera component in poseUpdater is needed to update the controller poses so don't remove it.
     
  6. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    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.
     
  7. VHornet

    VHornet

    Joined:
    Jul 10, 2012
    Posts:
    48
    I have the same error:

    GL.End requires material.SetPass before!
     
  8. sgsrules

    sgsrules

    Joined:
    Nov 11, 2013
    Posts:
    9
    Read my first comment for a solution
     
  9. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    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.
     
    Last edited: Dec 15, 2016
  10. sgsrules

    sgsrules

    Joined:
    Nov 11, 2013
    Posts:
    9
    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) :
    Code (csharp):
    1. if (poseUpdater == null)
    2. {
    3.      var go = new GameObject("poseUpdater");
    4.      go.transform.parent = transform;
    5.      poseUpdater = go.AddComponent<SteamVR_UpdatePoses>();
    6. }
    2) in SteamVR_UpdatePoses.cs remove the Awake method:
    Code (csharp):
    1. void Awake()
    2. {
    3.       var camera = GetComponent<Camera>();
    4.       camera.stereoTargetEye = StereoTargetEyeMask.None;
    5.       camera.clearFlags = CameraClearFlags.Nothing;
    6.       camera.useOcclusionCulling = false;
    7.       camera.cullingMask = 0;
    8.       camera.depth = -9999;
    9. }
    3) 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.
     
    Last edited: Dec 17, 2016
    zeb33 and mitchf like this.
  11. mitchf

    mitchf

    Joined:
    Aug 20, 2015
    Posts:
    1
    ^Confirmed solution. Nice Job +1
     
  12. gevarre

    gevarre

    Joined:
    Jan 19, 2009
    Posts:
    132
    @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?
     
  13. bbvrdev

    bbvrdev

    Joined:
    Aug 11, 2009
    Posts:
    221
    Well done! This worked for me.
     
  14. sgsrules

    sgsrules

    Joined:
    Nov 11, 2013
    Posts:
    9
    Yes, you're right it's actually SteamVR_Render.cs, i was looking at the wrong tab. Fixed the directions.
     
  15. T-Rocktopia

    T-Rocktopia

    Joined:
    Jul 16, 2014
    Posts:
    9
    @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.
     
  16. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    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.
     
  17. RakkuAmiya

    RakkuAmiya

    Joined:
    Jan 9, 2016
    Posts:
    53
    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
     
  18. mbbmbbmm

    mbbmbbmm

    Joined:
    Dec 28, 2013
    Posts:
    59
    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.
     
    Last edited: Jan 11, 2017
  19. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    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.
     
  20. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    Could you please file a bug report with a minimal reproduction case and reply in here with the case #?
     
  21. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    But this project's size is over 23 giga... and I don't know what minimum assets can reproduce this.

    Anyway, while not playing game, this error generates continuously.
     

    Attached Files:

  22. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    The same bug exists in 5.6b9. LeonhardP, I'm pretty sure that ANY SteamVR project is going to have this bug, so you shouldn't have any problems reproducing it.
     
  23. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
  24. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    Thank you! Can you give any ETA for the release of 5.6? Question: Once 5.6 is released, do you continue to fix bugs present in that release, or do you move on to the next version where they will be fixed? I ask because my game currently crashes every 10 minutes in 5.6b9 and I have absolutely no idea what the problem might be. I've submitted bug reports, but I'm not sure how helpful they are because I can never provide any information about what I'm doing that causes a crash. It just seems to happen randomly. I'm sure you're doing it already, but I'd rather see a hard-core effort towards making Unity crash proof that to add any additional features.
     
  25. Research_3DVAL

    Research_3DVAL

    Joined:
    Jun 26, 2014
    Posts:
    15
    Does Unity with an empty project/scene crash all the time or only when you are working on your project? If it's the latter it's probably something you can fix rather than waiting on updates from unity that may or may not solve your problem. Did the project work fine in earlier versions of the editor? When did the crashes first start appearing, maybe you can figure out what you added that's causing this.

    The problem with a "hard-core effort towards making Unity crash proof" is that there are so many use-cases. They always try to make it as stable as they can (that's part of the reason we have these Betas) but with complexity and flexibility comes the possibility of errors. We've all been in the situation where a seemingly innocent change to a script cascades over into a million errors! Even if they spend 2 years making the most stable version they can, as soon as they begin adding new features again there'll be new unexpected bugs to fix.
     
  26. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    I haven't spent any significant time working with projects other than the one I'm working on. I've been working on the project for a few months, so previously had been using most of the 5.5 betas. I've had crashes occasionally throughout the entire development, but saw an increase with the 5.6 betas that I've tried. I saw a message in another thread where someone from Unity said they had discovered an issue that causes memory corruption and this causes the Editor to crash in different places. The post said that the fix for this issue will be released in the next version (I assume 5.6b11) so I'm crossing my fingers that whatever fix they put in place will help with some of the crashing that I've experienced.
     
  27. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    Fixes for issues in older versions are usually not only released via new major releases (5.5, 5.6, 2017.1). They are backported and released via minor version updates (5.5f1, 5.5f2...). So yes, bugs that slip through into the final release still receive attention from our side. The ETA for 5.6 is end of March.