Skip to content

Commit 3d7b4e6

Browse files
committed
Empty image layers in the graphics compositor don't render black anymore
1 parent c00f01b commit 3d7b4e6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ public void UpdateOutputCamera()
552552
{
553553
var compositorData = m_LayerCamera.GetComponent<AdditionalCompositorData>();
554554
if (compositorData)
555-
compositorData.clearColorTexture = (m_Show && m_InputTexture != null) ? m_InputTexture : Texture2D.blackTexture;
555+
compositorData.clearColorTexture = (m_Show && m_InputTexture != null) ? m_InputTexture : null;
556556
}
557557

558558
if (m_LayerCamera.enabled)
@@ -653,14 +653,16 @@ public void SetupLayerCamera(CompositorLayer targetLayer, int layerPositionInSta
653653
{
654654
if (layerPositionInStack != 0)
655655
{
656-
// The next layer in the stack should clear with the texture of the previous layer: this will copy the content of the target RT to the RTHandle and preserve post process
656+
// The next layer in the stack should clear with the texture of the previous layer:
657+
// this will copy the content of the target RT to the RTHandle and preserve post process
658+
// Unless we have an image layer with a valid texture: in this case we use the texture as clear color
657659
cameraData.clearColorMode = HDAdditionalCameraData.ClearColorMode.None;
658660
var compositorData = m_LayerCamera.GetComponent<AdditionalCompositorData>();
659661
if (!compositorData)
660662
{
661663
compositorData = m_LayerCamera.gameObject.AddComponent<AdditionalCompositorData>();
662664
}
663-
if (m_Type != LayerType.Image)
665+
if (m_Type != LayerType.Image || (m_Type == LayerType.Image && m_InputTexture == null))
664666
{
665667
compositorData.clearColorTexture = targetLayer.GetRenderTarget();
666668
compositorData.clearDepthTexture = targetLayer.m_RTHandle;

0 commit comments

Comments
 (0)