SDR compensation for UI fixes the UI but results in the main scene no longer being visible.
We have a fullscreen UI element with a substrate material using additive blend and that particular combination seems to always write an output alpha of 1. This is not an issue in normal rendering because the UI is rendered directly onto the opaque scene but when SDR UI compensation is enabled the UI is rendered onto a transparent intermediate target where this bug results in writing opaque black. The opacity of the intermediate target is then used when compositing onto the scene, resulting in the scene being overwritten.
It looks like this stems from the GetMaterialColor() function in SlateElementPixelShader.usf, where the substrate version of additive blend outputs an alpha of 1 and the non-substrate version of additive blend outputs an alpha of 0 (see code snippet). Setting the output alpha to 0 in the substrate branch seems to resolve the problem.
Is there a reason for the substrate additive blend to use an alpha of 1?
half4 GetMaterialColor( VertexToPixelInterpolants InVertex, float2 MeshUV, float4 InFontSignedDistanceData = float4(0.0, 0.0, 0.0, 0.0) )
{
// ... code omitted for space
#elif MATERIALBLENDING_MODULATE
OutColor = half4(UnlitTransmittance, 0.0f);
#elif MATERIALBLENDING_ALPHAHOLDOUT
OutColor = half4(0.0f, 0.0f, 0.0f, UnlitGreyCoverage);
#elif MATERIALBLENDING_ADDITIVE
OutColor = half4(UnlitLuminance, 1.0); // <------------- this is 1, should it be 0?
#else // MATERIALBLENDING_TRANSLUCENT
OutColor = half4(UnlitLuminance, UnlitBSDF.Coverage);
#endif // MATERIALBLENDING_xxx
#endif// SUBSTRATE_OPAQUE_DEFERRED
#else // SUBSTRATE_ENABLED
half Opacity = GetMaterialOpacity(PixelMaterialInputs);
half3 Color = GetMaterialEmissive(PixelMaterialInputs);
#if MATERIALBLENDING_ADDITIVE
OutColor = half4(Color * Opacity, 0.0f); // <------------- this is the non-substrate path
#else
OutColor = half4(Color, Opacity);
#endif
#endif // SUBSTRATE_ENABLED
[Attachment Removed]