fix depth function

This commit is contained in:
ExMatics HydrogenC
2024-06-04 23:22:41 +08:00
parent 9bb6104cf7
commit 463c8dba0d
6 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -275,7 +275,7 @@ void PrepareDepthMip(const float4 inPos, int mipLevel, out float outD0, out floa
{
float4 depths = depthsArr[i];
float closest = max(max(depths.x, depths.y), max(depths.z, depths.w));
float closest = min(min(depths.x, depths.y), min(depths.z, depths.w));
CalculateRadiusParameters(abs(closest), 1.0, dummyUnused1, dummyUnused2, falloffCalcMulSq);
+1 -1
View File
@@ -44,7 +44,7 @@ float RayCastScreenSpaceShadow(GBufferData gBufferData, GBufferSample gBuffer, f
float3 rayUV = rayCS.xyz / rayCS.w;
rayUV.xy = rayUV.xy * float2(0.5, -0.5) + float2(0.5, 0.5);
float sceneDepth = SampleDepth(gBufferData, rayUV.xy) * gBufferData.ViewFar;
float rayDepth = LinearizeZ(rayUV.z) * gBufferData.ViewFar * 0.998;
float rayDepth = LinearizeZ(gBufferData, rayUV.z) * gBufferData.ViewFar * 0.998;
float surfaceThickness = 0.035f + rayDepth * rayLength;
float depthTestHardness = 0.005f;
float lightAmount = saturate((rayDepth - sceneDepth) / depthTestHardness) * saturate((sceneDepth + surfaceThickness - rayDepth) / depthTestHardness);