diff --git a/03-UnrealEngine/卡通渲染相关资料/渲染功能/阴影控制/ToonShadow.md b/03-UnrealEngine/卡通渲染相关资料/渲染功能/阴影控制/ToonShadow.md index 0ae3548..f815533 100644 --- a/03-UnrealEngine/卡通渲染相关资料/渲染功能/阴影控制/ToonShadow.md +++ b/03-UnrealEngine/卡通渲染相关资料/渲染功能/阴影控制/ToonShadow.md @@ -219,7 +219,7 @@ void FSceneRenderer::InitDynamicShadows(FRHICommandListImmediate& RHICmdList, FG - **FProjectedShadowInfo::RenderDepth()** - **FProjectedShadowInfo::RenderTranslucencyDepths** -RenderShadowDepthMapAtlases() 渲染的图集位于***FSceneRenderer::SortedShadowsForShadowDepthPass.ShadowMapAtlases*** +RenderShadowDepthMapAtlases() 渲染的图集位于***FSceneRenderer::SortedShadowsForShadowDepthPass.ShadowMapAtlases*** (ShadowMapAtlases.RenderTargets.DepthTarget为深度,ShadowMapAtlases.Shadows 为FProjectedShadowInfo) ## RenderDepth MeshDrawProcessor为***FShadowDepthPassMeshProcessor***。渲染的Shader为***ShadowDepthPixelShader.usf*** @@ -841,11 +841,25 @@ FSceneRenderer::RenderShadowProjections() ### Shader ShadowProjectionPixelShader.usf - - ShadowProjectionCommon.ush - ShadowDepthTexture - ShadowDepthCubeTexture +主要步骤: +1. 将SceneDepth(ScreenSpace) => (ShadowSpace) +2. 根据过滤方式调用: + 1. 不过滤:`Shadow = LightSpacePixelDepthForOpaque < Texture2DSampleLevel(ShadowDepthTexture, ShadowDepthTextureSampler, ShadowPosition.xy, 0).r;` + 2. PCSS:初始化FPCSSSamplerSettings之后调用DirectionalPCSS() + 3. PCF:初始化FPCFSamplerSettings之后调用ManualPCF() +3. 调整阴影数值。钳制、模糊、过滤。 +4. `OutColor = EncodeLightAttenuation(half4(FadedShadow, FadedSSSShadow, FadedShadow, FadedSSSShadow));`LinearSpace => sRGB 本质为sqrt(input),比pow(x, 1/2.2) 节约性能。 + +## 总结 +1. RenderDepth()渲染完深度贴图之后,经过GatherAndSortLights()、ComputeLightGrid()获取到经过剪裁的FSortedLightSetSceneInfo &SortedLightSet,之后传递给RenderLights()。 +2. BindShadowProjectionShaders() => BindShaderShaders() => +3. TShadowProjectionPS => ProjectionParameters.Bind(Initializer); => ShadowDepthTexture.Bind(ParameterMap,TEXT("ShadowDepthTexture")); + + # 半程阴影 由晨风&Neverwind提出: - 【[UFSH2024]用虚幻引擎5为《幻塔》定制高品质动画流程风格化渲染管线 | 晨风 Neverwind 完美世界游戏】 【精准空降到 07:27】 https://www.bilibili.com/video/BV1rW2LYvEox/?share_source=copy_web&vd_source=fe8142e8e12816535feaeabd6f6cdc8e&t=447