void FCompositionLighting::ProcessLpvIndirect(FRHICommandListImmediate& RHICmdList, FViewInfo& View) { check(IsInRenderingThread()); FMemMark Mark(FMemStack::Get()); FRenderingCompositePassContext CompositeContext(RHICmdList, View); FPostprocessContext Context(CompositeContext.Graph, View); if(IsLpvIndirectPassRequired(Context)) { FSceneRenderTargets& SceneContext = FSceneRenderTargets::Get(RHICmdList); FRenderingCompositePass* SSAO = Context.Graph.RegisterPass(new FRCPassPostProcessInput(SceneContext.ScreenSpaceAO)); FRenderingCompositePass* Pass = Context.Graph.RegisterPass(new FRCPassPostProcessLpvIndirect()); Pass->SetInput(ePId_Input0, Context.FinalOutput); Pass->SetInput(ePId_Input1, SSAO ); Context.FinalOutput = FRenderingCompositeOutputRef(Pass); } // The graph setup should be finished before this line ---------------------------------------- SCOPED_DRAW_EVENT(RHICmdList, CompositionLpvIndirect); // we don't replace the final element with the scenecolor because this is what those passes should do by themself CompositeContext.Process(Context.FinalOutput.GetPass(), TEXT("CompositionLighting")); }
bool ShouldRenderScreenSpaceAmbientOcclusion(const FViewInfo& View) { bool bEnabled = true; if (!IsLpvIndirectPassRequired(View)) { bEnabled = View.FinalPostProcessSettings.AmbientOcclusionIntensity > 0 && View.Family->EngineShowFlags.Lighting && View.FinalPostProcessSettings.AmbientOcclusionRadius >= 0.1f && !View.Family->UseDebugViewPS() && (FSSAOHelper::IsBasePassAmbientOcclusionRequired(View) || IsAmbientCubemapPassRequired(View) || IsReflectionEnvironmentActive(View) || IsSkylightActive(View) || View.Family->EngineShowFlags.VisualizeBuffer) && !IsAnyForwardShadingEnabled(View.GetShaderPlatform()); } return bEnabled; }
// @return 0:off, 0..4 static uint32 ComputeAmbientOcclusionPassCount(FPostprocessContext& Context) { uint32 Ret = 0; bool bEnabled = true; if(!IsLpvIndirectPassRequired(Context)) { bEnabled = Context.View.FinalPostProcessSettings.AmbientOcclusionIntensity > 0 && Context.View.FinalPostProcessSettings.AmbientOcclusionRadius >= 0.1f && (IsBasePassAmbientOcclusionRequired(Context) || IsAmbientCubemapPassRequired(Context) || IsReflectionEnvironmentActive(Context) || IsSkylightActive(Context) || Context.View.Family->EngineShowFlags.VisualizeBuffer ) && !IsSimpleDynamicLightingEnabled(); } if(bEnabled) { static const auto ICVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.AmbientOcclusionLevels")); Ret = FMath::Clamp(ICVar->GetValueOnRenderThread(), 0, 4); } return Ret; }