46 lines
1.5 KiB
HLSL
46 lines
1.5 KiB
HLSL
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "../Common.ush"
|
|
#include "../SceneTextureParameters.ush"
|
|
#include "LumenReflectionCommon.ush"
|
|
#include "LumenReflectionDenoiserCommon.ush"
|
|
|
|
RWTexture2DArray<float3> RWResolvedSpecular;
|
|
RWTexture2DArray<float4> RWSpecularAndSecondMoment;
|
|
RWTexture2D<float4> RWFinalRadiance;
|
|
RWTexture2D<float3> RWBackgroundVisibility;
|
|
|
|
uint bClearToSceneColor;
|
|
uint ClosureIndex;
|
|
|
|
/**
|
|
* Clear tiles which won't be processed, so that temporal and spatial denoising passes don't pickup uninitialized values.
|
|
*/
|
|
[numthreads(REFLECTION_THREADGROUP_SIZE_2D, REFLECTION_THREADGROUP_SIZE_2D, 1)]
|
|
void LumenReflectionDenoiserClearCS(
|
|
uint GroupId : SV_GroupID,
|
|
uint2 GroupThreadId : SV_GroupThreadID)
|
|
{
|
|
FReflectionTileData TileData;
|
|
const uint2 ReflectionScreenCoord = GetReflectionClearScreenCoord(GroupId, GroupThreadId, TileData);
|
|
|
|
const FLumenMaterialCoord Coord = GetLumenMaterialCoord_Reflection(ReflectionScreenCoord, TileData, ClosureIndex);
|
|
|
|
if (all(Coord.SvPosition < View.ViewRectMinAndSize.xy + View.ViewRectMinAndSize.zw))
|
|
{
|
|
RWResolvedSpecular[Coord.SvPositionFlatten] = INVALID_LIGHTING;
|
|
RWSpecularAndSecondMoment[Coord.SvPositionFlatten] = float4(INVALID_LIGHTING, 0.0f);
|
|
|
|
#if CLEAR_FINAL_RADIANCE_AND_BACKGROUND_VISIBILITY
|
|
if (bClearToSceneColor != 0)
|
|
{
|
|
RWFinalRadiance[Coord.SvPosition] = SceneTexturesStruct.SceneColorTexture.Load(int3(Coord.SvPosition, 0));
|
|
}
|
|
else
|
|
{
|
|
RWFinalRadiance[Coord.SvPosition] = float4(0, 0, 0, 1);
|
|
RWBackgroundVisibility[Coord.SvPosition] = 1.0f;
|
|
}
|
|
#endif
|
|
}
|
|
} |