Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Mnstrspeed's avatar
Mnstrspeed
Honored Guest
7 years ago

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)

1 Reply

Replies have been turned off for this discussion


  • 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.