Dark halo in footage that has semitransparent content

Hi Magic Leap!

I was hoping to get your opinion on some issue we are having when recording footage when we configure the camera to have an alpha override of 1.

I suppose it's easiest to explain if you see it in a video, here you will see footage of ML2 followed by footage of Hololens 2 also recording at full opacity.

As you can see, there is a dark halo around all the content that has transparency and I'm not sure how to fix it, in the footage you can also see the same scene in Hololens 2, at full opacity without any issues.

What do you think is the problem? we are using the old render pipeline

This might be related to this other post

This is the biggest problem we have, I want to replace my HL2 it's a dinosaur! help me out :slight_smile:

Hi @javier Apologies for the delay, I'm on it. I'll report back asap.

Hi @javier I spoke with our engineers. ML2 in this case was inferring alpha from color/depth. What's happening is "alpha boost," where everything above a threshold is considered to have a fixed alpha. We are working to resolve this issue but it won't be in the next release this month. In the meantime, are you able to turn off the alpha override and instead send the alpha via unity? Also please make sure Segmented Dimmer toggle is enabled in settings.

Hi @kdowney! thanks for helping out.

Though I'm not sure I follow what you mean by "send the alpha via Unity". The alpha is properly set on the shaders, as you can see it works correctly in other platforms. Is there anything else I can do specifically for ML 2?

I was under the impression that the digital content is artificially made transparent when recording just to make it so recorded footage more accurately depicts the user experience, something I disagree with but that's another story.

Thanks for following up @javier. I talked with our graphics engineers and the idea was basically sending the alpha via Unity by either upgrading the project to 2022.2.12f1+ or through URP post-processing effects to directly control the alpha output of the final frame.

Our team noted we're working to smooth this out, but I think the timeline is later this summer as best as I can determine. Please let me know if this helps.

I did update to 2022.2.14 but the issue remains, unless I have to initiate capture through code? I'm doing it with the built in camera function from the OS.

I can't change to URP, though if there's a way to fix this before the proper fix comes in summer it would be amazing.

One other thing our team noticed: With an alpha override of 1, those dark halos would be fully expected if there is even a little non-zero color around those white orbs. Not sure if that's intended, but if it isn't then you may also address the issue by ensuring there isn't any extra content around the orbs.

I guess I just don't understand what's going on behind the scenes, I don't even understand why footage is translucent to begin with and I don't understand why there needs to be an alpha override either.

From my point of view, I render things with the proper color, alpha and depth, so I would expect it to render correctly when recording footage.

I anticipated trouble explaining myself, so that's why I added Hololens 2 footage, it's at the end of the video. That's my way of saying: "This is how it should look like".

@javier This appears to be a depth writing or depth test issue. Our 3rd eye camera records opaque objects even if they appear transparent in the headset.

One solution is to render the areas not effects by the shadow as transparent. To accomplish this edit lines 100 -109 to set the ZWrite to Off and ZTest to LEqual to disable depth writing and set the depth test function to less or equal.

        Pass
        {
            Tags { "LightMode" = "ForwardBase" }
            Blend SrcAlpha OneMinusSrcAlpha
            ZWrite Off
            ZTest LEqual
            CGPROGRAM
            #pragma vertex vert_shadow
            #pragma fragment frag_shadow
            #pragma multi_compile_fwdbase
            ENDCG
        }

You also have to do this to the subshader by changing lines 63 - 73 to:

      Tags{ "Queue" = "Geometry" "IgnoreProjector" = "True" "RenderType" = "Opaque" }
        LOD 100
        // Depth fill pass
        Pass
        {
            ColorMask 0
            ZWrite Off
            ZTest LEqual
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

Here is what it looks like in the editor:

Thanks @ababilinski, this is was an answer to a different post so I'll reply to you there: