Skip to main content
New Participant
July 4, 2018

OVROverlay incorrectly premultiplies alpha on Android?

So I was banging my head against the wall as to why my compositor layers with transparency came out looking all wrong, like they were using a wrong blend mode:

(white texture with a radial gradient in the alpha channel; screenshot taken on an Oculus Go)

Turns out OVROverlay.cs at lines 454-457 and 468-471 sets the _premultiply property of the blit material to 1 for non-Android build targets to enable premultiplying on PC. However, the default value of _premultiply in the shader is already 1 and is never set to 0 for Android targets. Hence it would seem like textures on Android are also premultiplied even though the compositor use alpha blending.

Explicitly setting _premultiply to 0 on Android fixes my issues. Am I correct in assuming this is a bug or am I missing something here?

(Applies to Unity 2017.2.0f3 and Oculus Utilities 1.26, haven't had a chance to test with 1.27)
    This topic has been closed for replies.

    1 reply

    Inspiring
    July 12, 2018


    Hi @Mnstrspeed , It's not clear what is supposed to be changed in lines 454-457 per your recommendation. Your comment about changing the int material property _premultiply to 0 by modifying 468-471 with an additional compile flag for #elif UNITY_ANDROID && !UNITY_EDITOR is totally understood, but I'm not sure what relevance modifying the variables rt and dataIsLinear has on this.

    @imperativity stoked to hear this is patched! Thanks for the follow up.
    Samsung Galaxy S8 (Snapdragon 835), Gear VR (2017), Oculus Go (64GB), Unity 2018.3.14f1