diff options
Diffstat (limited to 'brdf.cginc')
| -rw-r--r-- | brdf.cginc | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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) |
