cancel
Showing results for 
Search instead for 
Did you mean: 

OVROverlay Underlay with gaps

Shiffle
Honored Guest
Recently I've been experimenting with using OVROverlay to render the UI for my app as the quality is much better than what can be achieved by default with Unity.
Since the app displays the controllers at all times, I tried using an Underlay to display the UI. The one issue I'm having is handling transparent spots inside my UI. So far, all of the examples with Underlays are displaying an opaque object and I can't figure out how to make it work with my UI.

Here's how it looks.2kexo256ehzu.jpga50lulrb8p2u.jpg
The first image uses an Underlay to display the UI, while the second is a regular world space canvas. The black background (1st pic) is a Quad with Underlay Impostor material. I understand that it is needed in order to render the Underlay but I'm having an issue with the empty spaces in-between that become filled.
If I understand this https://developer.oculus.com/documentation/unity/latest/concepts/unity-ovroverlay/?locale=en_US correctly, by using Underlay, I'm placing the UI behind everything else in the scene.  I'm guessing that's why the Underlay's camera Solid Color is displayed.
My question is what setup is needed to render my UI Underlay with a "transparent" background? Will I need to place another Underlay behind it to act as skysphere?
3 REPLIES 3

JoshuaVe
Protege

I know this is like a 4 year old post, but since I had a similar issue, this is because the shader being used doesn't have a clip/discard on it.  So what I do is ensure that the underlay quad has the output texture that the Overlay uses, and then clip if the alpha is under some amount, ie:

half4 frag(vertexOut input) : SV_Target
{
half4 outColor = tex2D(_MainTex, input.texCoord);
clip( outColor.a < 0.1f ? -1:1 );
return half4(outColor.xyz, 0);
}

How do you set a quad as the underlay's quad? I've been banging my head against the wall for hours on this. I saw your other post with the shader which was really helpful, but I just can't get the underlay to take it. 

JoshuaVe
Protege

So we've found it can be very finicky where you place the quad in the hierarchy of objects.  I've found the best success with putting the Overlay first, then having the quad be a child of the overlay.