BlueRoseNote/02-Note/ASoul/引擎相关.md

1.9 KiB
Raw Permalink Blame History

编译

  1. 需要安装CUDA Toolkit 11.8。
  2. 添加系统变量CUDA_PATH。数值为 "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8";
  3. 生成解决方案后,

移植到官方引擎

  1. 替换修改的引擎usf文件。
  2. 移除PostProcessTonemap.usf中的修改部分。
    1. 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
}