This commit is contained in:
StarBeats 2026-01-30 17:57:41 +08:00
parent 12b305e9a7
commit d7beb63413

View File

@ -198,7 +198,7 @@ float CalcSphereOcclusion2(in float3 pos, in float3 nor, in float4 sph)
// return clamp(1.0 - dot(nor, di) * rsqrt(sqL * sqL * sqL), 0.1, 1);
}
float sphOcclusion( in float3 pos, in float3 nor, in float4 sph )
float CalcSphereOcclusion2_( in float3 pos, in float3 nor, in float4 sph )
{
float3 di = sph.xyz - pos;
float l = length(di);
@ -241,7 +241,7 @@ float CalcCapsuleOcclusionByIndexV2(float3 p, float3 n, uint s, uint e, float in
// p 在 ba 上投影长度与 ba 长度比值
float t = /* abs(l) < 1e-8f ? 0.0 : */ saturate(dot(pa, ba) / l);
float3 positionToRay = capsule.a + t * ba;
ao *= sphOcclusion(p, n, float4(positionToRay, capsule.radius));
ao *= CalcSphereOcclusion2_(p, n, float4(positionToRay, capsule.radius));
}
ao = saturate(lerp(1, ao, intensity));
return saturate(lerp(1, ao, intensity1));