Hi!
A while ago I implemented a screen space blur for the SSAO pass. However since 4.11 this has been broken. I recently started working on getting it to work properly again, and I am almost there.
The only issue is… it turns everything… red?
Like this:
So, yes. Very red.
Does anyone have any ideas as to what is even going on here?! xD
Thanks,
.
Edit: Sorry, it just occured I should probably reference some code in here:
So! Right now the Blur code looks like this:
static FRenderingCompositeOutputRef BlurSSAOBuffer(FPostprocessContext& Context, FSceneRenderTargets& SceneContext, FRenderingCompositeOutputRef AO)
{
FRenderingCompositePass* SSAO = Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessInput(SceneContext.ScreenSpaceAO));
FRCPassPostProcessWeightedSampleSumInputBlur* PostProcessBlurX = Context.Graph.RegisterPass(new(FMemStack::Get())
FRCPassPostProcessWeightedSampleSumInputBlur(EFS_Horiz,
EFCM_Weighted,
CVarAmbientOcclusionBlurRadius.GetValueOnRenderThread(),
TEXT("SSAO Blur X")));
PostProcessBlurX->SetInput(ePId_Input0, SSAO);
PostProcessBlurX->AddDependency(AO);
FRCPassPostProcessWeightedSampleSumInputBlur* PostProcessBlurY = Context.Graph.RegisterPass(new(FMemStack::Get())
FRCPassPostProcessWeightedSampleSumInputBlur(
EFS_Vert,
EFCM_Weighted,
CVarAmbientOcclusionBlurRadius.GetValueOnRenderThread(),
TEXT("SSAO Blur Y")));
PostProcessBlurY->SetInput(ePId_Input0, SSAO);
PostProcessBlurY->AddDependency(PostProcessBlurX);
return PostProcessBlurY;
}
This function is called here:
FRenderingCompositePass* AmbientOcclusionPassMip0 = Context.Graph.RegisterPass(new(FMemStack::Get()) FRCPassPostProcessAmbientOcclusion(Context.View, FullResAOType, false));
AmbientOcclusionPassMip0->SetInput(ePId_Input0, GBufferA);
AmbientOcclusionPassMip0->SetInput(ePId_Input1, AmbientOcclusionInMip1);
AmbientOcclusionPassMip0->SetInput(ePId_Input2, AmbientOcclusionPassMip1);
AmbientOcclusionPassMip0->SetInput(ePId_Input3, HZBInput);
// to make sure this pass is processed as well (before), needed to make process decals before computing AO
if(AmbientOcclusionInMip1)
{
AmbientOcclusionInMip1->AddDependency(Context.FinalOutput);
}
else
{
AmbientOcclusionPassMip0->AddDependency(Context.FinalOutput);
}
FRenderingCompositeOutputRef BluredAO = FRenderingCompositeOutputRef(BlurSSAOBuffer(Context, SceneContext, FRenderingCompositeOutputRef(AmbientOcclusionPassMip0)));
Context.FinalOutput = BluredAO;// FRenderingCompositeOutputRef(AmbientOcclusionPassMip0);
SceneContext.bScreenSpaceAOIsValid = true;
return BluredAO;
The “FRCPassPostProcessWeightedSampleSumInputBlur” is a slightly modified version of WeightedSampleSum. The Main difference is instead of this:
FRCPassPostProcessWeightedSampleSum:
Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, DestRenderTarget.ShaderResourceTexture, false, FResolveParams());
FRCPassPostProcessWeightedSampleSumInputBlur:
Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, InputPooledElement->GetRenderTargetItem().TargetableTexture, false, FResolveParams());
Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, InputPooledElement->GetRenderTargetItem().ShaderResourceTexture, false, FResolveParams());