From 097f99dcc6696747965860bfdb1df910bd812b6f Mon Sep 17 00:00:00 2001 From: antonmic Date: Thu, 1 Jul 2021 21:14:04 -0700 Subject: [PATCH] [ATOM-15864] Added diffuseResponse to lambertian diffuse calculation --- .../Atom/Features/PBR/Lighting/EnhancedLighting.azsli | 2 +- .../ShaderLib/Atom/Features/PBR/Lighting/SkinLighting.azsli | 2 +- .../Atom/Features/PBR/Lighting/StandardLighting.azsli | 2 +- .../Assets/ShaderLib/Atom/Features/PBR/Microfacet/Brdf.azsli | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lighting/EnhancedLighting.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lighting/EnhancedLighting.azsli index 1b8d2c3001..58e589e9d8 100644 --- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lighting/EnhancedLighting.azsli +++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lighting/EnhancedLighting.azsli @@ -28,7 +28,7 @@ float3 GetDiffuseLighting(Surface surface, LightingData lightingData, float3 lig } else { - diffuse = DiffuseLambertian(surface.albedo, surface.normal, dirToLight); + diffuse = DiffuseLambertian(surface.albedo, surface.normal, dirToLight, lightingData.diffuseResponse); } if(o_clearCoat_feature_enabled) diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lighting/SkinLighting.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lighting/SkinLighting.azsli index a3c13459f4..ef256139c0 100644 --- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lighting/SkinLighting.azsli +++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lighting/SkinLighting.azsli @@ -28,7 +28,7 @@ float3 GetDiffuseLighting(Surface surface, LightingData lightingData, float3 lig } else { - diffuse = DiffuseLambertian(surface.albedo, surface.normal, dirToLight); + diffuse = DiffuseLambertian(surface.albedo, surface.normal, dirToLight, lightingData.diffuseResponse); } if(o_clearCoat_feature_enabled) diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lighting/StandardLighting.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lighting/StandardLighting.azsli index fa754479a0..201aeca321 100644 --- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lighting/StandardLighting.azsli +++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Lighting/StandardLighting.azsli @@ -20,7 +20,7 @@ // Then define the Diffuse and Specular lighting functions float3 GetDiffuseLighting(Surface surface, LightingData lightingData, float3 lightIntensity, float3 dirToLight) { - float3 diffuse = DiffuseLambertian(surface.albedo, surface.normal, dirToLight); + float3 diffuse = DiffuseLambertian(surface.albedo, surface.normal, dirToLight, lightingData.diffuseResponse); if(o_clearCoat_feature_enabled) { diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Microfacet/Brdf.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Microfacet/Brdf.azsli index 31626b60b3..81ab4de1d4 100644 --- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Microfacet/Brdf.azsli +++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PBR/Microfacet/Brdf.azsli @@ -21,10 +21,10 @@ // ------- Diffuse Lighting ------- //! Simple Lambertian BRDF. -float3 DiffuseLambertian(float3 albedo, float3 normal, float3 dirToLight) +float3 DiffuseLambertian(float3 albedo, float3 normal, float3 dirToLight, float diffuseResponse) { float NdotL = saturate(dot(normal, dirToLight)); - return albedo * NdotL * INV_PI; + return albedo * NdotL * INV_PI * diffuseResponse; } // Normalized Disney diffuse function taken from Frostbite's PBR course notes (page 10):