From 9a46ac121b1ae290e9cc8942ebf9bc3b1018dda3 Mon Sep 17 00:00:00 2001 From: BlueRose <378100977@qq.com> Date: Thu, 27 Mar 2025 18:35:48 +0800 Subject: [PATCH] vault backup: 2025-03-27 18:35:48 --- .../various-complements/histories.json | 2 +- ...umen学习笔记(5)——向往大佬文章学习笔记.md | 11 +++ .../卡通渲染相关资料/卡通渲染开发总览.md | 7 +- .../渲染功能/ToonReflection&GI控制/Toon GI & Lumen.md | 69 +++++++++++++++++++ 4 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 03-UnrealEngine/Rendering/RenderFeature/Lumen学习笔记(5)——向往大佬文章学习笔记.md create mode 100644 03-UnrealEngine/卡通渲染相关资料/渲染功能/ToonReflection&GI控制/Toon GI & Lumen.md diff --git a/.obsidian/plugins/various-complements/histories.json b/.obsidian/plugins/various-complements/histories.json index cf41a14..67f0da6 100644 --- a/.obsidian/plugins/various-complements/histories.json +++ b/.obsidian/plugins/various-complements/histories.json @@ -1 +1 @@ -{"Deprecated":{"Deprecated":{"internalLink":{"count":1,"lastUpdated":1740405714148}}},"PS.需要Shader添加FSceneTextureShaderParameters":{"PS.需要Shader添加FSceneTextureShaderParameters":{"currentFile":{"count":1,"lastUpdated":1740983366427}}},"和blender共同制作,山脉为":{"和blender共同制作,山脉为":{"currentFile":{"count":1,"lastUpdated":1741610747166}}},"BlueprintCosmetic":{"BlueprintCosmetic":{"internalLink":{"count":1,"lastUpdated":1741951657866}}},"ReflectionsColor":{"ReflectionsColor":{"currentFile":{"count":1,"lastUpdated":1742739458164}}},"主要执行了:":{"主要执行了:":{"currentFile":{"count":1,"lastUpdated":1742830096172}}},"尝试平滑Lumen中的SH。":{"尝试平滑Lumen中的SH。":{"currentFile":{"count":1,"lastUpdated":1742910977705}}}} \ No newline at end of file +{"PS.需要Shader添加FSceneTextureShaderParameters":{"PS.需要Shader添加FSceneTextureShaderParameters":{"currentFile":{"count":1,"lastUpdated":1740983366427}}},"和blender共同制作,山脉为":{"和blender共同制作,山脉为":{"currentFile":{"count":1,"lastUpdated":1741610747166}}},"BlueprintCosmetic":{"BlueprintCosmetic":{"internalLink":{"count":1,"lastUpdated":1741951657866}}},"ReflectionsColor":{"ReflectionsColor":{"currentFile":{"count":1,"lastUpdated":1742739458164}}},"主要执行了:":{"主要执行了:":{"currentFile":{"count":1,"lastUpdated":1742830096172}}},"尝试平滑Lumen中的SH。":{"尝试平滑Lumen中的SH。":{"currentFile":{"count":1,"lastUpdated":1742910977705}}},"SupportDynamicSliderMinValue":{"SupportDynamicSliderMinValue":{"internalLink":{"count":1,"lastUpdated":1743066829865}}}} \ No newline at end of file diff --git a/03-UnrealEngine/Rendering/RenderFeature/Lumen学习笔记(5)——向往大佬文章学习笔记.md b/03-UnrealEngine/Rendering/RenderFeature/Lumen学习笔记(5)——向往大佬文章学习笔记.md new file mode 100644 index 0000000..f4a21ed --- /dev/null +++ b/03-UnrealEngine/Rendering/RenderFeature/Lumen学习笔记(5)——向往大佬文章学习笔记.md @@ -0,0 +1,11 @@ +--- +title: 未命名 +date: 2025-03-27 16:31:21 +excerpt: +tags: +rating: ⭐ +--- +# 前言 + + +# LumenScreenProbeGather diff --git a/03-UnrealEngine/卡通渲染相关资料/卡通渲染开发总览.md b/03-UnrealEngine/卡通渲染相关资料/卡通渲染开发总览.md index 895ae5e..5cbf102 100644 --- a/03-UnrealEngine/卡通渲染相关资料/卡通渲染开发总览.md +++ b/03-UnrealEngine/卡通渲染相关资料/卡通渲染开发总览.md @@ -45,7 +45,6 @@ rating: ⭐⭐⭐ - 【【UE5卡渲】椿 - K表情练习】 https://www.bilibili.com/video/BV1ay411b7Cm/?share_source=copy_web&vd_source=fe8142e8e12816535feaeabd6f6cdc8e - 卡通渲染晕染效果【【UE5】一些最近做的好玩的卡渲后效】 https://www.bilibili.com/video/BV1gi421v7HA/?share_source=copy_web&vd_source=fe8142e8e12816535feaeabd6f6cdc8e - [【Unity/虚幻5/Blender】3种引擎 绝区零风格 卡通渲染 星见雅 完整流程](https://www.bilibili.com/video/BV1kBBKYRE6Q/?share_source=copy_web&vd_source=fe8142e8e12816535feaeabd6f6cdc8e) - - - 动漫制作 - 2024年4月新番 Girls Band cry【日本最顶级的3D动画制作过程【GBC官方动捕制作片段】】 https://www.bilibili.com/video/BV1uM4m1U7CL/?share_source=copy_web&vd_source=fe8142e8e12816535feaeabd6f6cdc8e @@ -127,11 +126,14 @@ rating: ⭐⭐⭐ 3. [ ] Matcap 4. [ ] ASoul边缘光 10. [ ] Reflection控制 + 1. [x] ReflectionAlpha实现。 + 2. [ ] Matcap Reflection实现。 11. [ ] Toon GI(Lumen) 1. [ ] 向下采样 2. [ ] 平滑法线采样 1. [ ] 使用哪个https://zhuanlan.zhihu.com/p/25839790454 - 2. [ ] 尝试平滑Lumen中的SH。 + 2. [ ] 尝试抹平Lumen法线。 + 3. [ ] 尝试使用ViewVector来平滑法线。 1. 用相机方向的话,随着相机绕角色旋转,角色身上亮度变化会比较明显,所以视频里用的是把平滑度乘在Lumen的1-2阶球谐上 2. 伪代码 OutSH = SH0 + (SH1 + SH2) * Smoothness; 12. [ ] 阴影控制 @@ -146,6 +148,7 @@ rating: ⭐⭐⭐ 14. [ ] ToonTranslucent 1. [ ] 通过模仿SingleLayerWater实现折射效果 https://zhuanlan.zhihu.com/p/657928532 2. [ ] 眉眼细节 [[幻塔-眉眼细节.png]] + 1. [ ] 【【Unity/虚幻5/Blender】3种引擎 崩坏: 星穹铁道风格 卡通渲染 从球谐光照到眉毛透过刘海 完整流程】 【精准空降到 1:24:29】 https://www.bilibili.com/video/BV1CN411C7qx/?share_source=copy_web&vd_source=fe8142e8e12816535feaeabd6f6cdc8e&t=5069 3. [ ] [【UE5】逐材质stencil、半透明排序、OverlayMaterial](https://zhuanlan.zhihu.com/p/31171114411) 15. [ ] TSR 1. [ ] [UE TAAU详细解析](https://zhuanlan.zhihu.com/p/681910495) diff --git a/03-UnrealEngine/卡通渲染相关资料/渲染功能/ToonReflection&GI控制/Toon GI & Lumen.md b/03-UnrealEngine/卡通渲染相关资料/渲染功能/ToonReflection&GI控制/Toon GI & Lumen.md new file mode 100644 index 0000000..315a986 --- /dev/null +++ b/03-UnrealEngine/卡通渲染相关资料/渲染功能/ToonReflection&GI控制/Toon GI & Lumen.md @@ -0,0 +1,69 @@ +--- +title: 未命名 +date: 2025-03-27 17:37:02 +excerpt: +tags: +rating: ⭐ +--- +# Toon Lumen +抹平法线思路: + +在`LumenScreenProbeGather.usf`中对法线进行抹平处理。其Pass位于 +- DiffuseIndirectAndAO + - LumenScreenProbeGather + - Integrate + - SimpleDiffuse/SupportImportanceSampleBRDF?/SupportAll? + +在如下位置添加代码: +```c++ +if (IsValid(Material)) + { + const float2 ScreenUV = (Coord.SvPosition + 0.5f) * View.BufferSizeAndInvSize.zw; + const float3 WorldPosition = GetWorldPositionFromScreenUV(ScreenUV, Material.SceneDepth); + const float3 WorldNormal = Material.WorldNormal; + //BlueRose Modify + if (Material.ShadingID == SHADINGMODELID_TOONSTANDARD) + { + //使用Yu-ki016的方法“抹平法线” + float3 V = normalize(LWCHackToFloat(PrimaryView.WorldCameraOrigin) - WorldPosition); + const uint ToonDataAssetID = GetToonDataAssetIDFromGBuffer(Material.GBufferData); + float DiffuseIndirectLightingFlatten = GetDiffuseIndirectLightingFlatten(ToonDataAssetID); + Material.WorldNormal = normalize(lerp(WorldNormal, V, DiffuseIndirectLightingFlatten)); + } + //BlueRose Modify End + ... + } +} +``` + +该方法存在一些问题:**当相机围绕角色旋转时,角色身上的 GI变化会比较明显**。 + +# Spherical Harmonics +UE5中采样球谐贴图方法(ReflectionEnvironmentShared.ush): +```c++ +/** + * Computes sky diffuse lighting from the SH irradiance map. + * This has the SH basis evaluation and diffuse convolution weights combined for minimal ALU's - see "Stupid Spherical Harmonics (SH) Tricks" + */ +float3 GetSkySHDiffuse(float3 Normal) +{ + float4 NormalVector = float4(Normal, 1.0f); + + float3 Intermediate0, Intermediate1, Intermediate2; + Intermediate0.x = dot(SkyIrradianceEnvironmentMap[0], NormalVector); + Intermediate0.y = dot(SkyIrradianceEnvironmentMap[1], NormalVector); + Intermediate0.z = dot(SkyIrradianceEnvironmentMap[2], NormalVector); + + float4 vB = NormalVector.xyzz * NormalVector.yzzx; + Intermediate1.x = dot(SkyIrradianceEnvironmentMap[3], vB); + Intermediate1.y = dot(SkyIrradianceEnvironmentMap[4], vB); + Intermediate1.z = dot(SkyIrradianceEnvironmentMap[5], vB); + + float vC = NormalVector.x * NormalVector.x - NormalVector.y * NormalVector.y; + Intermediate2 = SkyIrradianceEnvironmentMap[6].xyz * vC; + + // max to not get negative colors + return max(0, Intermediate0 + Intermediate1 + Intermediate2); +} +``` +