// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "SceneRendering.h" #include "RenderGraph.h" struct FSortedLightSceneInfo; struct FCloudShadowAOData; class FLightSceneInfo; class FProjectedShadowInfo; struct FTranslucencyLightingVolumeTextures { /** Maps view to a texture index, accounting for sharing between some views */ int32 GetIndex(const FViewInfo& View, int32 CascadeIndex) const; /** Initializes the translucent volume textures and clears them using a compute pass. PassFlags should be ERDGPassFlags::Compute or ERDGPassFlags::AsyncCompute. */ void Init(FRDGBuilder& GraphBuilder, TArrayView Views, ERDGPassFlags PassFlags); bool IsValid() const { check(!VolumeDim || (Ambient.Num() == Directional.Num() && Ambient.Num() > 0)); return VolumeDim != 0; } FRDGTextureRef GetAmbientTexture(const FViewInfo& View, int32 CascadeIndex) const { return Ambient[GetIndex(View, CascadeIndex)]; } FRDGTextureRef GetDirectionalTexture(const FViewInfo& View, int32 CascadeIndex) const { return Directional[GetIndex(View, CascadeIndex)]; } TArray> Ambient; TArray> Directional; int32 VolumeDim = 0; /** Mapping between the view index and texture pair - needed because stereo views shares textures. */ TArray> ViewsToTexturePairs; }; BEGIN_SHADER_PARAMETER_STRUCT(FTranslucencyLightingVolumeParameters, ) SHADER_PARAMETER_RDG_TEXTURE(Texture3D, TranslucencyLightingVolumeAmbientInner) SHADER_PARAMETER_RDG_TEXTURE(Texture3D, TranslucencyLightingVolumeAmbientOuter) SHADER_PARAMETER_RDG_TEXTURE(Texture3D, TranslucencyLightingVolumeDirectionalInner) SHADER_PARAMETER_RDG_TEXTURE(Texture3D, TranslucencyLightingVolumeDirectionalOuter) END_SHADER_PARAMETER_STRUCT() /** Initializes translucency volume lighting shader parameters from an optional textures struct. If null or uninitialized, fallback textures are used. */ FTranslucencyLightingVolumeParameters GetTranslucencyLightingVolumeParameters(FRDGBuilder& GraphBuilder, const FTranslucencyLightingVolumeTextures& Textures, const FViewInfo& View); void InjectTranslucencyLightingVolume( FRDGBuilder& GraphBuilder, const FViewInfo& View, const uint32 ViewIndex, const FScene* Scene, const FSceneRenderer& Renderer, const FTranslucencyLightingVolumeTextures& Textures, const TArrayView VisibleLightInfos, const FLightSceneInfo& LightSceneInfo, const FProjectedShadowInfo* ProjectedShadowInfo); void InjectTranslucencyLightingVolumeArray( FRDGBuilder& GraphBuilder, const TArrayView Views, const FScene* Scene, const FSceneRenderer& Renderer, const FTranslucencyLightingVolumeTextures& Textures, const TArrayView VisibleLightInfos, const TArrayView SortedLights, const TInterval SortedLightInterval); void InjectSimpleTranslucencyLightingVolumeArray( FRDGBuilder& GraphBuilder, const FViewInfo& View, const uint32 ViewIndex, const uint32 ViewCount, const FTranslucencyLightingVolumeTextures& Textures, const FSimpleLightArray& SimpleLights); void FinalizeTranslucencyLightingVolume( FRDGBuilder& GraphBuilder, const TArrayView Views, FTranslucencyLightingVolumeTextures& Textures); void InjectTranslucencyLightingVolumeAmbientCubemap( FRDGBuilder& GraphBuilder, const TArrayView Views, const FTranslucencyLightingVolumeTextures& Textures); void FilterTranslucencyLightingVolume( FRDGBuilder& GraphBuilder, const TArrayView Views, FTranslucencyLightingVolumeTextures& Textures);