Browse Source

Create opaque-only color buffer copy after opaque-only post-processing is done, and use the correct color format for the copy.

This creates a more accurate opaque-only reference for the auto-reactive pass, and improves compatibility with custom opaque-only effects.
fsr2
Nico de Poel 3 years ago
parent
commit
56d0050a72
  1. 17
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs

17
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs

@ -685,12 +685,9 @@ namespace UnityEngine.Rendering.PostProcessing
aoRenderer.Get().RenderAfterOpaque(context); aoRenderer.Get().RenderAfterOpaque(context);
} }
bool fsrRequiresOpaque = context.IsSuperResolutionActive() && (superResolution.autoGenerateReactiveMask || superResolution.autoGenerateTransparencyAndComposition);
bool isFogActive = fog.IsEnabledAndSupported(context); bool isFogActive = fog.IsEnabledAndSupported(context);
bool hasCustomOpaqueOnlyEffects = HasOpaqueOnlyEffects(context); bool hasCustomOpaqueOnlyEffects = HasOpaqueOnlyEffects(context);
int opaqueOnlyEffects = 0; int opaqueOnlyEffects = 0;
opaqueOnlyEffects += fsrRequiresOpaque ? 1 : 0;
opaqueOnlyEffects += isScreenSpaceReflectionsActive ? 1 : 0; opaqueOnlyEffects += isScreenSpaceReflectionsActive ? 1 : 0;
opaqueOnlyEffects += isFogActive ? 1 : 0; opaqueOnlyEffects += isFogActive ? 1 : 0;
opaqueOnlyEffects += hasCustomOpaqueOnlyEffects ? 1 : 0; opaqueOnlyEffects += hasCustomOpaqueOnlyEffects ? 1 : 0;
@ -714,13 +711,6 @@ namespace UnityEngine.Rendering.PostProcessing
cmd.BuiltinBlit(context.source, context.destination, RuntimeUtilities.copyStdMaterial, stopNaNPropagation ? 1 : 0); cmd.BuiltinBlit(context.source, context.destination, RuntimeUtilities.copyStdMaterial, stopNaNPropagation ? 1 : 0);
UpdateSrcDstForOpaqueOnly(ref srcTarget, ref dstTarget, context, cameraTarget, opaqueOnlyEffects); UpdateSrcDstForOpaqueOnly(ref srcTarget, ref dstTarget, context, cameraTarget, opaqueOnlyEffects);
} }
if (fsrRequiresOpaque)
{
m_opaqueOnly = context.GetScreenSpaceTemporaryRT();
cmd.BuiltinBlit(context.source, m_opaqueOnly);
opaqueOnlyEffects--;
}
if (isScreenSpaceReflectionsActive) if (isScreenSpaceReflectionsActive)
{ {
@ -741,6 +731,13 @@ namespace UnityEngine.Rendering.PostProcessing
cmd.ReleaseTemporaryRT(srcTarget); cmd.ReleaseTemporaryRT(srcTarget);
} }
// Create a copy of the opaque-only color buffer for auto-reactive mask generation
if (context.IsSuperResolutionActive() && (superResolution.autoGenerateReactiveMask || superResolution.autoGenerateTransparencyAndComposition))
{
m_opaqueOnly = context.GetScreenSpaceTemporaryRT(colorFormat: sourceFormat);
m_LegacyCmdBufferOpaque.BuiltinBlit(cameraTarget, m_opaqueOnly);
}
// Post-transparency stack // Post-transparency stack
int tempRt = -1; int tempRt = -1;

Loading…
Cancel
Save