diff options
Diffstat (limited to 'brdf.cginc')
| -rwxr-xr-x | brdf.cginc | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -167,12 +167,13 @@ float4 brdf(Pbr pbr, LightData data) { cc_dfg = float3(1, 1, 1); } float cc_Ess = max(cc_dfg.y, 1e-4f); - float cc_energy_comp = 1.0f + cc_f0 * (rcp(cc_Ess) - 1.0f); + //float cc_energy_comp = 1.0f + cc_f0 * (rcp(cc_Ess) - 1.0f); + float cc_energy_comp = 1; #endif float3 f0_color = lerp(f0, pbr.albedo.xyz, pbr.metallic); - float Ess = max(dfg.y, 1e-4f); - float3 energy_comp = 1.0f + f0_color * (rcp(Ess) - 1.0f); + //float3 energy_comp = 1.0f + f0_color * (rcp(dfg.yyy) - 1.0f); + float3 energy_comp = 1.0f; // Direct { @@ -247,18 +248,18 @@ float4 brdf(Pbr pbr, LightData data) { remainder -= Fcl * pbr.cl_strength; #endif - // Standard PBR IBL using split-sum approximation - // Specular lobe + // Standard split-sum IBL float3 f0_spec = lerp(f0, pbr.albedo.xyz, pbr.metallic); + //float3 ibl_specular_reflectance = f0_spec * dfg.x + dfg.y; float3 ibl_specular_reflectance = lerp(dfg.xxx, dfg.yyy, f0_spec); - float3 indirect_specular = data.indirect.specular * ibl_specular_reflectance * energy_comp; - const float3 F = F_Schlick(data.indirect.NoL, f0_spec, f90); - const float3 is_conserved = indirect_specular * F; + //float3 ibl_specular_reflectance = f0_spec * dfg.x; + float3 indirect_specular = data.indirect.specular * ibl_specular_reflectance; + + //return float4(data.indirect.specular, 1); - specular += is_conserved; - remainder = saturate(remainder - is_conserved); + specular += indirect_specular; + remainder = saturate(remainder - indirect_specular); - // Diffuse is Lambertian, which is pre-integrated into the SH diffuse probe float3 indirect_diffuse = pbr.albedo.xyz * data.indirect.diffuse * remainder * (1.0 - pbr.metallic); diffuse += indirect_diffuse; } |
