VCloud on translucent fading in region depth can now be controled via a cvar.

#rb none
#preflight https://horde.devtools.epicgames.com/job/637617a43248425305c21519

[CL 23174402 by Sebastien Hillaire in ue5-main branch]
This commit is contained in:
Sebastien Hillaire
2022-11-17 07:27:58 -05:00
parent 54ef15aea8
commit 4c3d0a7a95
5 changed files with 9 additions and 4 deletions
@@ -1338,7 +1338,7 @@ void FPixelShaderInOut_MainPS(
NDCPosition, LWCHackToFloat(MaterialParameters.AbsoluteWorldPosition), LWCHackToFloat(ResolvedView.WorldCameraOrigin),
TranslucentBasePass.VolumetricCloudColor, TranslucentBasePass.VolumetricCloudColorSampler,
TranslucentBasePass.VolumetricCloudDepth, TranslucentBasePass.VolumetricCloudDepthSampler,
OneOverPreExposure, Fogging);
OneOverPreExposure, Fogging, TranslucentBasePass.SoftBlendingDistanceKm);
}
#endif
@@ -108,7 +108,7 @@ void Main(
Output.Position, WorldPosition.xyz, ResolvedView.TranslatedWorldCameraOrigin,
TranslucentBasePass.VolumetricCloudColor, TranslucentBasePass.VolumetricCloudColorSampler,
TranslucentBasePass.VolumetricCloudDepth, TranslucentBasePass.VolumetricCloudDepthSampler,
OneOverPreExposure, Output.BasePassInterpolants.VertexFog);
OneOverPreExposure, Output.BasePassInterpolants.VertexFog, TranslucentBasePass.SoftBlendingDistanceKm);
}
#endif
@@ -77,7 +77,7 @@ float4 GetCloudLuminanceTransmittanceOverFog(
float4 NDC, float3 SampledWorldPos, float3 CameraWorldPos,
Texture2D<float4> VolumetricCloudColor, SamplerState VolumetricCloudColorSampler,
Texture2D<float4> VolumetricCloudDepth, SamplerState VolumetricCloudDepthSampler,
float OneOverPreExposure, float4 CurrentVertexFog)
float OneOverPreExposure, float4 CurrentVertexFog, float SoftBlendingDistanceKm)
{
float2 ScreenUv = (NDC.xy / NDC.ww) * float2(0.5f, -0.5f) + 0.5f;
@@ -99,7 +99,6 @@ float4 GetCloudLuminanceTransmittanceOverFog(
float4 CloudFog = Texture2DSample(VolumetricCloudColor, VolumetricCloudColorSampler, ScreenUv);
CloudFog.rgb *= OneOverPreExposure;
const float SoftBlendingDistanceKm = 0.5f;// 500 meters
const float BlendFactor = saturate(DepthInsideKm / SoftBlendingDistanceKm);
const float4 FogToApplyUnder = CurrentVertexFog;
const float4 FogToApplyOver = lerp(float4(0.0, 0.0, 0.0, 1.0), CloudFog, BlendFactor);