diff --git a/features/Subsurface Scattering/Shaders/SubsurfaceScattering/SeparableSSS.hlsli b/features/Subsurface Scattering/Shaders/SubsurfaceScattering/SeparableSSS.hlsli index e484a6a98..5af252b96 100644 --- a/features/Subsurface Scattering/Shaders/SubsurfaceScattering/SeparableSSS.hlsli +++ b/features/Subsurface Scattering/Shaders/SubsurfaceScattering/SeparableSSS.hlsli @@ -104,14 +104,14 @@ float RGBToLuminance(float3 color) float InterleavedGradientNoise(float2 uv) { if (FrameCount == 0) - return 0.5; + return 1.0; // Temporal factor float frameStep = float(FrameCount % 16) * 0.0625f; uv.x += frameStep * 4.7526; uv.y += frameStep * 3.1914; float3 magic = float3(0.06711056f, 0.00583715f, 52.9829189f); - return frac(magic.z * frac(dot(uv, magic.xy))); + return frac(magic.z * frac(dot(uv, magic.xy))) * 1.5; } #define SSSS_N_SAMPLES 25 @@ -222,7 +222,6 @@ float4 SSSSBlurPS( colorM.a = sss.x; if (colorM.a == 0) return colorM; - colorM.a = 1; // Fetch linear depth of current pixel: float depthM = DepthTexture.SampleLevel(PointSampler, texcoord, 0).r; @@ -265,8 +264,8 @@ float4 SSSSBlurPS( float scale = distanceToProjectionWindow / depthM; // Calculate the final step to fetch the surrounding pixels: - float2 finalStep = scale * dir; - finalStep *= colorM.a; // Modulate it using the alpha channel. + float2 finalStep = scale * dir / 3.0; + finalStep *= 1; // Modulate it using the alpha channel. finalStep *= InterleavedGradientNoise(texcoord * BufferDim); // Randomise width to fix banding // Accumulate the other samples: @@ -291,9 +290,9 @@ float4 SSSSBlurPS( colorBlurred.rgb += kernel[i].rgb * color.rgb; } - // colorBlurred = lerp(colorM, colorBlurred, 1.0 - (sss.x * sss.x)); + colorBlurred = lerp(colorM, colorBlurred, colorM.a); - return lerp(colorM, colorBlurred, sss.x); + return colorBlurred; } //----------------------------------------------------------------------------- diff --git a/package/Shaders/Lighting.hlsl b/package/Shaders/Lighting.hlsl index bb2d2ec8b..5d1578a18 100644 --- a/package/Shaders/Lighting.hlsl +++ b/package/Shaders/Lighting.hlsl @@ -2165,14 +2165,15 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace psout.Albedo.xyz = Lin2sRGB(psout.Albedo.xyz); #endif -#if defined(SKIN_SHADING) - float3 albedo = baseColor.xyz * input.Color.xyz; - float ao; - Material2PBR(albedo, albedo, ao); - psout.Deferred.x = ao; +#if defined(SKIN_SHADING) + // float3 albedo = baseColor.xyz * input.Color.xyz; + // float ao; + // Material2PBR(albedo, albedo, ao); + psout.Deferred = 1; #endif - psout.Deferred.w = 0; + + psout.Deferred.w = psout.Albedo.w; psout.Specular.xyz = 0; #if defined(SKIN_SHADING)