|
10 | 10 | #define ENABLE_ENVIRONMENT_PROBE |
11 | 11 | #endif |
12 | 12 |
|
| 13 | +#ifdef _GLOSSYREFLECTIONS_OFF |
| 14 | +#define _ENVIRONMENTREFLECTIONS_OFF |
| 15 | +#endif |
| 16 | + |
13 | 17 | TEXTURE2D(_DFG); |
14 | 18 | SAMPLER(sampler_DFG); |
15 | 19 |
|
@@ -76,10 +80,10 @@ half GetHorizonOcclusion(float3 reflectVector, float3 vertexNormalWS) |
76 | 80 |
|
77 | 81 | half3 CalculateIrradianceFromReflectionProbes(half3 reflectVector, float3 positionWS, half perceptualRoughness, float2 normalizedScreenSpaceUV, float3 vertexNormalWS) |
78 | 82 | { |
79 | | - half3 irradiance = half3(0.0h, 0.0h, 0.0h); |
| 83 | + half3 irradiance = 0.0; |
80 | 84 | half mip = PerceptualRoughnessToMipmapLevel(perceptualRoughness); |
81 | | -#if USE_FORWARD_PLUS |
82 | | - float totalWeight = 0.0f; |
| 85 | +#if USE_CLUSTER_LIGHT_LOOP && CLUSTER_HAS_REFLECTION_PROBES |
| 86 | + float totalWeight = 0.0; |
83 | 87 | uint probeIndex; |
84 | 88 | ClusterIterator it = ClusterInit(normalizedScreenSpaceUV, positionWS, 1); |
85 | 89 | [loop] while (ClusterNext(it, probeIndex) && totalWeight < 0.99f) |
@@ -192,7 +196,11 @@ half3 CalculateIrradianceFromReflectionProbes(half3 reflectVector, float3 positi |
192 | 196 | // Use any remaining weight to blend to environment reflection cube map |
193 | 197 | if (totalWeight < 0.99f) |
194 | 198 | { |
| 199 | + #ifdef UNIVERSALRP |
| 200 | + half4 encodedIrradiance = half4(SAMPLE_TEXTURECUBE_LOD(_GlossyEnvironmentCubeMap, sampler_GlossyEnvironmentCubeMap, reflectVector, mip)); |
| 201 | + #else |
195 | 202 | half4 encodedIrradiance = half4(SAMPLE_TEXTURECUBE_LOD(_GlossyEnvironmentCubeMap, samplerunity_SpecCube0, reflectVector, mip)); |
| 203 | + #endif |
196 | 204 |
|
197 | 205 | irradiance += (1.0f - totalWeight) * DecodeHDREnvironment(encodedIrradiance, _GlossyEnvironmentCubeMap_HDR) * GetHorizonOcclusion(reflectVector, vertexNormalWS); |
198 | 206 | } |
|
0 commit comments