diff options
| author | yum <yum.food.vr@gmail.com> | 2024-10-05 17:32:47 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-10-05 17:32:47 -0700 |
| commit | 144d7bc5cc999b9c5f84a9a7fc2a86dafe276df1 (patch) | |
| tree | f258bc63750ed35720110edc457a1703763daf5d /pbr.cginc | |
| parent | 54cf2749759045b646282c5e28139510d3e7783e (diff) | |
Fix SSR
Diffstat (limited to 'pbr.cginc')
| -rw-r--r-- | pbr.cginc | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -285,7 +285,7 @@ float4 getLitColor( // Do this to avoid division by 0. If both light sources are black, // sum_brightness could be 0; #if defined(_BRIGHTNESS_CLAMP) - brightnesses = max(brightnesses, min(_Min_Brightness, .001)); + brightnesses = max(brightnesses, _Min_Brightness); #endif float sum_brightness = brightnesses[0] + brightnesses[1]; float2 brightness_proportions = brightnesses / sum_brightness; @@ -336,11 +336,24 @@ float4 getLitColor( float2 screenUVs = 0; float4 screenPos = 0; + #if SSR_ENABLED + screenUVs = i.screenPos.xy / (i.screenPos.w+0.0000000001); + #if UNITY_SINGLE_PASS_STEREO || defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED ) + screenUVs.x *= 2; + #endif + screenPos = i.screenPos; + #endif + #if 1 float reflection_strength = _ReflectionStrength; #if defined(_REFLECTION_STRENGTH_TEX) reflection_strength *= _ReflectionStrengthTex.SampleLevel(linear_repeat_s, i.uv0, 0); #endif +#if defined(SSR_MASK) + float ssr_mask = _SSR_Mask.SampleLevel(linear_repeat_s, i.uv0, 0); +#else + float ssr_mask = 1; +#endif float4 pbr = BRDF1_Mochie_PBS( albedo, specular_tint, @@ -359,7 +372,8 @@ float4 getLitColor( vertexLightColor, direct_light, indirect_light, - reflection_strength); + reflection_strength, + ssr_mask); #else float3 pbr = UNITY_BRDF_PBS( albedo, |
