diff --git a/02-Note/DAWA/ASoul/引擎相关.md b/02-Note/DAWA/ASoul/引擎相关.md index 6f7f46f..627c6aa 100644 --- a/02-Note/DAWA/ASoul/引擎相关.md +++ b/02-Note/DAWA/ASoul/引擎相关.md @@ -6,5 +6,58 @@ # 移植到官方引擎 1. 替换修改的引擎usf文件。 -2. 移除ToneMapping.usf中的修改部分。 - 1. `tonemapping那里多加了一张图,从c++加的` \ No newline at end of file +2. 移除PostProcessTonemap.usf中的修改部分。 + 1. `tonemapping那里多加了一张图,从c++加的` + +```hlsl +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 +} +``` \ No newline at end of file