diff options
| -rwxr-xr-x | brdf.cginc | 14 | ||||
| -rwxr-xr-x | lighting.cginc | 2 |
2 files changed, 14 insertions, 2 deletions
@@ -7,6 +7,7 @@ #include "pema99.cginc" #include "pbr.cginc" #include "glitter.cginc" +#include "poi.cginc" float pow5(float x) { float x2 = x * x; @@ -284,9 +285,20 @@ float4 brdf(v2f i, Pbr pbr, LightData data, out BrdfData bd) { { [branch] if (_UdonLightVolumeEnabled) { - specular += LightVolumeSpecular(pbr.albedo.xyz, pbr.smoothness, + float3 light_volume_specular = LightVolumeSpecular(pbr.albedo.xyz, pbr.smoothness, pbr.metallic, pbr.normal, data.common.V, data.indirect.L00, data.indirect.L01r, data.indirect.L01g, data.indirect.L01b); + +#if defined(_BRIGHTNESS_CLAMP) + float3 light_volume_specular_hsv = RGBtoHSV(light_volume_specular); + light_volume_specular_hsv[2] = clamp(light_volume_specular_hsv[2], 0, _Brightness_Clamp_Max); + light_volume_specular = HSVtoRGB(light_volume_specular_hsv); +#endif +#if defined(_BRIGHTNESS_MULTIPLIER) + light_volume_specular *= _Brightness_Multiplier; +#endif + + specular += light_volume_specular; } } #endif diff --git a/lighting.cginc b/lighting.cginc index db9cee0..835613e 100755 --- a/lighting.cginc +++ b/lighting.cginc @@ -144,7 +144,7 @@ float4 getIndirectDiffuse(v2f i, Pbr pbr, inout LightData light) { #if defined(_BENT_NORMALS) diffuse.xyz += max(0, yumSH9(float4(pbr.bent_normal, 1.0), i.worldPos, light.indirect)); #else - diffuse.xyz += max(0, yumSH9(float4(i.normal, 1.0), i.worldPos, light.indirect)); + diffuse.xyz += max(0, yumSH9(float4(pbr.normal, 1.0), i.worldPos, light.indirect)); #endif #endif |
