From ac8b84febfaef3dc91cabed6f77b9f3b2826dd3d Mon Sep 17 00:00:00 2001 From: BlueRose <378100977@qq.com> Date: Fri, 21 Jun 2024 18:28:18 +0800 Subject: [PATCH] vault backup: 2024-06-21 18:28:18 --- .../various-complements/histories.json | 2 +- 02-Note/DAWA/ASoul/渲染方案/Shader修改部分.md | 36 ++++++++++++++++--- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.obsidian/plugins/various-complements/histories.json b/.obsidian/plugins/various-complements/histories.json index 5d7c90a..5896dd1 100644 --- a/.obsidian/plugins/various-complements/histories.json +++ b/.obsidian/plugins/various-complements/histories.json @@ -1 +1 @@ -{"ECS资料":{"ECS资料":{"currentFile":{"count":1,"lastUpdated":1716465594941}}},"DebugView":{"DebugView":{"internalLink":{"count":1,"lastUpdated":1716796051996}}},".p4ignore":{".p4ignore":{"currentFile":{"count":1,"lastUpdated":1717048569032}}},"admin":{"admin":{"currentFile":{"count":1,"lastUpdated":1717123692206}}},"具体的命令应该说是":{"具体的命令应该说是":{"currentFile":{"count":1,"lastUpdated":1717749753511}}},"添加一个Idol.xxx标签。":{"添加一个Idol.xxx标签。":{"currentFile":{"count":2,"lastUpdated":1718092533903}}},"FGBufferData":{"FGBufferData":{"currentFile":{"count":1,"lastUpdated":1718936545718}}}} \ No newline at end of file +{"ECS资料":{"ECS资料":{"currentFile":{"count":1,"lastUpdated":1716465594941}}},"DebugView":{"DebugView":{"internalLink":{"count":1,"lastUpdated":1716796051996}}},".p4ignore":{".p4ignore":{"currentFile":{"count":1,"lastUpdated":1717048569032}}},"admin":{"admin":{"currentFile":{"count":1,"lastUpdated":1717123692206}}},"具体的命令应该说是":{"具体的命令应该说是":{"currentFile":{"count":1,"lastUpdated":1717749753511}}},"添加一个Idol.xxx标签。":{"添加一个Idol.xxx标签。":{"currentFile":{"count":2,"lastUpdated":1718092533903}}},"FGBufferData":{"FGBufferData":{"currentFile":{"count":1,"lastUpdated":1718936545718}}},"中添加写入FGBufferData逻辑。代码如下:":{"中添加写入FGBufferData逻辑。代码如下:":{"currentFile":{"count":1,"lastUpdated":1718964454078}}}} \ No newline at end of file diff --git a/02-Note/DAWA/ASoul/渲染方案/Shader修改部分.md b/02-Note/DAWA/ASoul/渲染方案/Shader修改部分.md index 4bfce92..e95c0bb 100644 --- a/02-Note/DAWA/ASoul/渲染方案/Shader修改部分.md +++ b/02-Note/DAWA/ASoul/渲染方案/Shader修改部分.md @@ -1,7 +1,3 @@ -# TODO -- [ ] [[#BasePass]] -- [ ] [[#DeferredShadingCommon.ush]] - # Common ## Common.ush 添加结构体,主要用在材质的CustomNode里。 @@ -633,6 +629,38 @@ FDirectLighting IntegrateBxDF( FGBufferData GBuffer, half3 N, half3 V, half3 L, ``` ## DeferredLightPixelShaders.usf +在DeferredLightPixelMain()中添加逻辑: +1. 非卡通材质正常渲染。 +2. 材质材质只有在LightingChannel = 2时才会计算卡通光影效果。 +```c++ +bool UseToonShadow = IsToonShadingModel(ScreenSpaceData.GBuffer.ShadingModelID); +// LightingChannel Toon Shading only calculate light of LightingChannel = 2 +BRANCH if (!UseToonShadow || (UseToonShadow && DeferredLightUniforms.LightingChannelMask & 0x4)) +{ + const float SceneDepth = CalcSceneDepth(InputParams.ScreenUV); + const FDerivedParams DerivedParams = GetDerivedParams(InputParams, SceneDepth); + + FDeferredLightData LightData = InitDeferredLightFromUniforms(CURRENT_LIGHT_TYPE); + UpdateLightDataColor(LightData, InputParams, DerivedParams); + +#if USE_HAIR_COMPLEX_TRANSMITTANCE + if (ScreenSpaceData.GBuffer.ShadingModelID == SHADINGMODELID_HAIR && ShouldUseHairComplexTransmittance(ScreenSpaceData.GBuffer)) + { + LightData.HairTransmittance = EvaluateDualScattering(ScreenSpaceData.GBuffer, DerivedParams.CameraVector, -DeferredLightUniforms.Direction); + } +#endif + + float Dither = InterleavedGradientNoise(InputParams.PixelPos, View.StateFrameIndexMod8); + + float SurfaceShadow = 1.0f; + + float4 LightAttenuation = GetLightAttenuationFromShadow(InputParams, SceneDepth); + float4 Radiance = GetDynamicLighting(DerivedParams.TranslatedWorldPosition, DerivedParams.CameraVector, ScreenSpaceData.GBuffer, ScreenSpaceData.AmbientOcclusion, ScreenSpaceData.GBuffer.ShadingModelID, LightData, LightAttenuation, Dither, uint2(InputParams.PixelPos), SurfaceShadow); + + OutColor += Radiance; +} +``` + # PostProcess ## ToneMapping c++部分主要修改了: