99#define SSR_MINIMUM_ATTENUATION 0.275
1010#define SSR_ATTENUATION_SCALE (1.0 - SSR_MINIMUM_ATTENUATION)
1111
12- #define SSR_VIGNETTE_INTENSITY 0.7
13- #define SSR_VIGNETTE_SMOOTHNESS 0.25
12+ #define SSR_VIGNETTE_INTENSITY _VignetteIntensity
13+ #define SSR_VIGNETTE_SMOOTHNESS 5 .
1414
1515#define SSR_COLOR_NEIGHBORHOOD_SAMPLE_SPREAD 1.0
1616
@@ -73,9 +73,10 @@ float4x4 _InverseViewMatrix;
7373float4x4 _InverseProjectionMatrix;
7474float4x4 _ScreenSpaceProjectionMatrix;
7575
76- float4 _Params; // x: attenuation , y: distance fade, z: maximum march distance, w: blur pyramid lod count
76+ float4 _Params; // x: vignette intensity , y: distance fade, z: maximum march distance, w: blur pyramid lod count
7777float4 _Params2; // x: aspect ratio, y: noise tiling, z: thickness, w: maximum iteration count
78- #define _Attenuation _Params.x
78+ #define _Attenuation .25
79+ #define _VignetteIntensity _Params.x
7980#define _DistanceFade _Params.y
8081#define _MaximumMarchDistance _Params.z
8182#define _BlurPyramidLODCount _Params.w
@@ -100,6 +101,7 @@ float Attenuate(float2 uv)
100101float Vignette (float2 uv)
101102{
102103 float2 k = abs (uv - 0.5 ) * SSR_VIGNETTE_INTENSITY;
104+ k.x *= _MainTex_TexelSize.y * _MainTex_TexelSize.z;
103105 return pow (saturate (1.0 - dot (k, k)), SSR_VIGNETTE_SMOOTHNESS);
104106}
105107
@@ -381,7 +383,9 @@ float4 FragComposite(VaryingsDefault i) : SV_Target
381383 float4 color = _MainTex.Sample (sampler_MainTex, i.texcoordStereo);
382384 color.rgb = max (0.0 , color.rgb - reflectionProbes.rgb);
383385
384- float fade = 1.0 - resolve.a * _DistanceFade;
386+ resolve.a *= 2 . * resolve.a; // 2 and 1.5 are quite important for the correct ratio of 3:2 distribution
387+ float fade = 1.0 - saturate (1.5 * resolve.a * smoothstep (0.5 , 1.0 , 1.5 * resolve.a) * _DistanceFade);
388+
385389 resolve.rgb = lerp (reflectionProbes.rgb, resolve.rgb, confidence * fade);
386390 color.rgb += resolve.rgb * gbuffer0.a;
387391
0 commit comments