summaryrefslogtreecommitdiffstats
path: root/brdf.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-10-12 21:52:50 -0700
committeryum <yum.food.vr@gmail.com>2025-10-12 21:52:50 -0700
commit228e555dbd07dd1a332a07770106dfd98f918c9b (patch)
tree8f058e1c897ba818dedc2564676f0278eddce128 /brdf.cginc
parenta4bf31470f7e2855f13d922e3e7ad1c7767d9afd (diff)
fornite update
Diffstat (limited to 'brdf.cginc')
-rw-r--r--brdf.cginc10
1 files changed, 5 insertions, 5 deletions
diff --git a/brdf.cginc b/brdf.cginc
index d89558c..8352c08 100644
--- a/brdf.cginc
+++ b/brdf.cginc
@@ -138,7 +138,7 @@ float4 brdf(Pbr pbr, LightData data) {
// Direct
{
- float remainder = 1.0f;
+ float3 remainder = 1.0f;
#if defined(_CLEARCOAT)
float cc_f0 = 0.04f;
@@ -149,7 +149,7 @@ float4 brdf(Pbr pbr, LightData data) {
float3 direct_specular_cc = DFGcc * data.direct.color * data.direct.NoL_cc * pbr.cc_strength;
direct_specular_cc = max(0, direct_specular_cc);
specular += direct_specular_cc;
- remainder -= Fcc * pbr.cc_strength;
+ remainder = saturate(remainder - direct_specular_cc);
#endif
#if defined(_CLOTH_SHEEN)
@@ -173,7 +173,7 @@ float4 brdf(Pbr pbr, LightData data) {
float3 direct_specular = FDG * remainder * data.direct.color * data.direct.NoL * lerp(1.0f, pbr.albedo.xyz, pbr.metallic);
direct_specular = max(0, direct_specular);
specular += direct_specular;
- remainder -= F;
+ remainder = saturate(remainder - direct_specular);
float Fd = Fd_OrenNayar(pbr.roughness, data.common.NoV, data.direct.NoL, data.direct.LoV) / PI;
float3 direct_diffuse = Fd * remainder * (1.0f - pbr.metallic) * pbr.albedo.xyz * data.direct.color;
@@ -184,7 +184,7 @@ float4 brdf(Pbr pbr, LightData data) {
// Indirect
#if defined(FORWARD_BASE_PASS)
{
- float remainder = 1.0f;
+ float3 remainder = 1.0f;
float2 dfg_uv = float2(pbr.roughness, data.common.NoV);
#if defined(_CLEARCOAT)
@@ -192,7 +192,7 @@ float4 brdf(Pbr pbr, LightData data) {
float Fcc = F_Schlick(data.common.NoV, cc_f0, 1.0f);
float3 indirect_specular_cc = Fcc * data.indirect.specular_cc * pbr.cc_strength;
specular += indirect_specular_cc;
- remainder -= Fcc * pbr.cc_strength;
+ remainder = saturate(remainder - indirect_specular_cc);
#endif
#if defined(_CLOTH_SHEEN)