diff options
| -rw-r--r-- | 2ner.shader | 7 | ||||
| -rw-r--r-- | features.cginc | 4 | ||||
| -rw-r--r-- | globals.cginc | 5 | ||||
| -rw-r--r-- | yum_brdf.cginc | 3 | ||||
| -rw-r--r-- | yum_lighting.cginc | 17 |
5 files changed, 29 insertions, 7 deletions
diff --git a/2ner.shader b/2ner.shader index 937c560..eb182f1 100644 --- a/2ner.shader +++ b/2ner.shader @@ -2284,6 +2284,13 @@ Shader "yum_food/2ner" _Min_Brightness("Value", Range(0, 1)) = 0 [HideInInspector] m_end_Min_Brightness("Minimum brightness", Float) = 0 //endex + //ifex _Light_Volumes_Brightness_Enabled==0 + [HideInInspector] m_start_Light_Volumes_Brightness("Light Volumes Brightness", Float) = 0 + [ThryToggle(_LIGHT_VOLUMES_BRIGHTNESS)] _Light_Volumes_Brightness_Enabled("Enable", Float) = 0 + _Light_Volumes_Brightness_Enabled_Dynamic("Enable (dynamic)", Float) = 1 + _Light_Volumes_Brightness("Brightness", Range(0, 1)) = 1 + [HideInInspector] m_end_Light_Volumes_Brightness("Light Volumes Brightness", Float) = 0 + //endex //ifex _Quasi_Shadows_Enabled==0 [HideInInspector] m_start_Quasi_Shadows("Quasi Shadows", Float) = 0 [ThryToggle(_QUASI_SHADOWS)] _Quasi_Shadows_Enabled("Enable", Float) = 0 diff --git a/features.cginc b/features.cginc index 442506e..803b7c6 100644 --- a/features.cginc +++ b/features.cginc @@ -519,5 +519,9 @@ #pragma shader_feature_local _QUASI_SHADOWS //endex +//ifex _Light_Volumes_Brightness_Enabled==0 +#pragma shader_feature_local _LIGHT_VOLUMES_BRIGHTNESS +//endex + #endif // __FEATURES_INC diff --git a/globals.cginc b/globals.cginc index 0c3b9ed..ff5d42e 100644 --- a/globals.cginc +++ b/globals.cginc @@ -92,6 +92,11 @@ float _Brightness_Multiplier; float _Min_Brightness;
#endif
+#if defined(_LIGHT_VOLUMES_BRIGHTNESS)
+float _Light_Volumes_Brightness_Enabled_Dynamic;
+float _Light_Volumes_Brightness;
+#endif
+
#if defined(_QUANTIZE_NOL)
float _Quantize_NoL_Steps;
#endif
diff --git a/yum_brdf.cginc b/yum_brdf.cginc index b8d4d0b..b1913f7 100644 --- a/yum_brdf.cginc +++ b/yum_brdf.cginc @@ -257,10 +257,7 @@ float4 YumBRDF(v2f i, const YumLighting light, YumPbr pbr) { const float3 E = specularDFG(dfg, f0); const float3 energy_compensation = energyCompensation(dfg, f0); - // Compute specular ambient occlusion float diffuseAO = pbr.ao; - - // Use proper diffuse color calculation float3 diffuseColor = computeDiffuseColor(pbr.albedo, pbr.metallic); float3 Fd = diffuseColor * light.diffuse * (1.0 - E) * pbr.ao * remainder; diff --git a/yum_lighting.cginc b/yum_lighting.cginc index 29b9846..f3ccb46 100644 --- a/yum_lighting.cginc +++ b/yum_lighting.cginc @@ -277,6 +277,18 @@ float3 yumSH9(float4 n, float3 worldPos, inout YumLighting light) { #else // !YUM_SH9_STANDARD LightVolumeSH(worldPos, light.L00, light.L01r, light.L01g, light.L01b); +#if defined(_LIGHT_VOLUMES_BRIGHTNESS) + [branch] + if (_Light_Volumes_Brightness_Enabled_Dynamic) { + float3 probe_L00 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w); + float t = _Light_Volumes_Brightness; + light.L00 = lerp(probe_L00, light.L00, t); + light.L01r = lerp(unity_SHAr.xyz, light.L01r, t); + light.L01g = lerp(unity_SHAg.xyz, light.L01g, t); + light.L01b = lerp(unity_SHAb.xyz, light.L01b, t); + } +#endif + // Hack to get directional information from SH. float3 light_dir = normalize(float3(luminance(light.L01r), luminance(light.L01g), luminance(light.L01b))); light.derivedLight.l = light_dir; @@ -293,10 +305,7 @@ float3 yumSH9(float4 n, float3 worldPos, inout YumLighting light) { light.L01b *= l1_wrap; #endif // _WRAPPED_LIGHTING - return light.L00 + float3( - dot(light.L01r, n.xyz), - dot(light.L01g, n.xyz), - dot(light.L01b, n.xyz)); + return LightVolumeEvaluate(n.xyz, light.L00, light.L01r, light.L01g, light.L01b); #endif } |
