From 906844a68e607dd020d0a6e655007980bcb183aa Mon Sep 17 00:00:00 2001 From: BlueRose <378100977@qq.com> Date: Sun, 19 Jan 2025 22:02:41 +0800 Subject: [PATCH] vault backup: 2025-01-19 22:02:41 --- .../渲染功能/PostProcess/Toon ToneMapping.md | 7 +++ .../渲染功能/PostProcess/ToonPostProcess.md | 57 ++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 03-UnrealEngine/卡通渲染相关资料/渲染功能/PostProcess/Toon ToneMapping.md diff --git a/03-UnrealEngine/卡通渲染相关资料/渲染功能/PostProcess/Toon ToneMapping.md b/03-UnrealEngine/卡通渲染相关资料/渲染功能/PostProcess/Toon ToneMapping.md new file mode 100644 index 0000000..d823e11 --- /dev/null +++ b/03-UnrealEngine/卡通渲染相关资料/渲染功能/PostProcess/Toon ToneMapping.md @@ -0,0 +1,7 @@ +--- +title: Toon ToneMapping +date: 2025-01-19 21:02:19 +excerpt: +tags: +rating: ⭐ +--- diff --git a/03-UnrealEngine/卡通渲染相关资料/渲染功能/PostProcess/ToonPostProcess.md b/03-UnrealEngine/卡通渲染相关资料/渲染功能/PostProcess/ToonPostProcess.md index 5ce856c..3930a39 100644 --- a/03-UnrealEngine/卡通渲染相关资料/渲染功能/PostProcess/ToonPostProcess.md +++ b/03-UnrealEngine/卡通渲染相关资料/渲染功能/PostProcess/ToonPostProcess.md @@ -124,4 +124,59 @@ BEGIN_SHADER_PARAMETER_STRUCT(FSceneTextureShaderParameters, ENGINE_API) SHADER_PARAMETER_RDG_UNIFORM_BUFFER(FSceneTextureUniformParameters, SceneTextures) SHADER_PARAMETER_RDG_UNIFORM_BUFFER(FMobileSceneTextureUniformParameters, MobileSceneTextures) END_SHADER_PARAMETER_STRUCT() -``` \ No newline at end of file +``` + + + +# ToneMapping +- UE4/UE5和ACES工作流程:https://zhuanlan.zhihu.com/p/660965710 + +TonemapCommon.ush中的FilmToneMap()在CombineLUTsCommon()中调用。其顺序为: +1. AddCombineLUTPass() => PostProcessCombineLUTs.usf +2. AddTonemapPass() => PostProcessTonemap.usf + +```c++ +void AddPostProcessingPasses() +{ +... + { + FRDGTextureRef ColorGradingTexture = nullptr; + + if (bPrimaryView) + { + ColorGradingTexture = AddCombineLUTPass(GraphBuilder, View); + } + // We can re-use the color grading texture from the primary view. + else if (View.GetTonemappingLUT()) + { + ColorGradingTexture = TryRegisterExternalTexture(GraphBuilder, View.GetTonemappingLUT()); + } + else + { + const FViewInfo* PrimaryView = static_cast(View.Family->Views[0]); + ColorGradingTexture = TryRegisterExternalTexture(GraphBuilder, PrimaryView->GetTonemappingLUT()); + } + + FTonemapInputs PassInputs; + PassSequence.AcceptOverrideIfLastPass(EPass::Tonemap, PassInputs.OverrideOutput); + PassInputs.SceneColor = SceneColorSlice; + PassInputs.Bloom = Bloom; + PassInputs.SceneColorApplyParamaters = SceneColorApplyParameters; + PassInputs.LocalExposureTexture = LocalExposureTexture; + PassInputs.BlurredLogLuminanceTexture = LocalExposureBlurredLogLumTexture; + PassInputs.LocalExposureParameters = &LocalExposureParameters; + PassInputs.EyeAdaptationParameters = &EyeAdaptationParameters; + PassInputs.EyeAdaptationBuffer = EyeAdaptationBuffer; + PassInputs.ColorGradingTexture = ColorGradingTexture; + PassInputs.bWriteAlphaChannel = AntiAliasingMethod == AAM_FXAA || bProcessSceneColorAlpha; + PassInputs.bOutputInHDR = bTonemapOutputInHDR; + + SceneColor = AddTonemapPass(GraphBuilder, View, PassInputs); + } +... +} +``` + +## PostProcessCombineLUTs.usf + +## PostProcessTonemap.usf \ No newline at end of file