Files
UnrealEngine/Engine/Shaders/Private/StochasticLighting/StochasticLightingDenoising.usf
2025-05-18 13:04:45 +08:00

33 lines
1.1 KiB
HLSL

// Copyright Epic Games, Inc. All Rights Reserved.
#define USE_HAIR_COMPLEX_TRANSMITTANCE 1
#include "../Common.ush"
#include "../Lumen/LumenMaterial.ush"
#include "StochasticLightingCommon.ush"
RWTexture2D<float> RWDepthTexture;
RWTexture2D<float4> RWNormalTexture;
/**
* Copy depth and normal for opaque before it gets overwritten by water or other translucency writing depth
*/
[numthreads(THREADGROUP_SIZE, THREADGROUP_SIZE, 1)]
void StoreSceneHistoryCS(
uint2 DispatchThreadId : SV_DispatchThreadID)
{
uint2 ScreenCoord = DispatchThreadId + View.ViewRectMinAndSize.xy;
FLumenMaterialData LumenMaterial = ReadMaterialData(ScreenCoord);
RWDepthTexture[DispatchThreadId + View.ViewRectMinAndSize.xy] = ConvertToDeviceZ(LumenMaterial.SceneDepth);
#if PERMUTATION_STORE_NORMAL
{
FNormalAndShadingInfo Info;
Info.Normal = LumenMaterial.WorldNormal;
Info.bIsHair = LumenMaterial.bIsHair;
Info.bHasBackfaceDiffuse = LumenMaterial.bHasBackfaceDiffuse;
RWNormalTexture[DispatchThreadId + View.ViewRectMinAndSize.xy] = PackNormalAndShadingInfo(Info);
}
#endif
}