1.9 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			1.9 KiB
		
	
	
	
	
	
	
	
编译
- 需要安装CUDA Toolkit 11.8。
 - 添加系统变量,CUDA_PATH。数值为: "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8";
 - 生成解决方案后,
 
移植到官方引擎
- 替换修改的引擎usf文件。
 - 移除PostProcessTonemap.usf中的修改部分。
tonemapping那里多加了一张图,从c++加的
 
void MainPS(
	in noperspective float2 UV : TEXCOORD0,
	in noperspective float2 InVignette : TEXCOORD1,
	in noperspective float4 GrainUV : TEXCOORD2,
	in noperspective float2 ScreenPos : TEXCOORD3,
	in noperspective float2 FullViewUV : TEXCOORD4,
	float4 SvPosition : SV_POSITION,		// after all interpolators
	out float4 OutColor : SV_Target0
#if OUTPUT_LUMINANCE
	, out float OutLuminance: SV_Target1
#endif
	)
{
	float Luminance;
	FGBufferData SamplerBuffer = GetGBufferData(UV * View.ResolutionFractionAndInv.x, false);
	if (SamplerBuffer.CustomStencil > 1.0f && abs(SamplerBuffer.CustomDepth - SamplerBuffer.Depth) < 1)
	{
		OutColor = SampleSceneColor(UV);
	}
	else
	{
    	OutColor = TonemapCommonPS(UV, InVignette, GrainUV, ScreenPos, FullViewUV, SvPosition, Luminance);
    }
#if OUTPUT_LUMINANCE
	OutLuminance = Luminance;
#endif
}
还原成原本样式:
void MainPS(
	in noperspective float2 UV : TEXCOORD0,
	in noperspective float2 InVignette : TEXCOORD1,
	in noperspective float4 GrainUV : TEXCOORD2,
	in noperspective float2 ScreenPos : TEXCOORD3,
	in noperspective float2 FullViewUV : TEXCOORD4,
	float4 SvPosition : SV_POSITION,		// after all interpolators
	out float4 OutColor : SV_Target0
#if OUTPUT_LUMINANCE
	, out float OutLuminance: SV_Target1
#endif
	)
{
	float Luminance;
	FGBufferData SamplerBuffer = GetGBufferData(UV * View.ResolutionFractionAndInv.x, false);
	OutColor = TonemapCommonPS(UV, InVignette, GrainUV, ScreenPos, FullViewUV, SvPosition, Luminance);
#if OUTPUT_LUMINANCE
	OutLuminance = Luminance;
#endif
}