Browse Source

Merge pull request #7764 from Popov72/clearcoat

PBR: Update the energy conservation factor for the clear coat layer
sebavan 5 năm trước cách đây
mục cha
commit
0593d5a4bf
2 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 1 0
      dist/preview release/what's new.md
  2. 5 1
      src/Shaders/pbr.fragment.fx

+ 1 - 0
dist/preview release/what's new.md

@@ -30,6 +30,7 @@
 
 ### Materials
 - Added the `roughness` and `albedoScaling` parameters to PBR sheen ([Popov72](https://github.com/Popov72))
+- Updated the energy conservation factor for the clear coat layer in PBR materials ([Popov72](https://github.com/Popov72))
 
 ## Bugs
 

+ 5 - 1
src/Shaders/pbr.fragment.fx

@@ -983,6 +983,10 @@ void main(void) {
         #endif
 
         specularEnvironmentReflectance *= conservationFactor;
+
+        #if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
+            vec3 energyConservationFactorClearCoat = getEnergyConservationFactor(specularEnvironmentR0, environmentClearCoatBrdf);
+        #endif
     #endif
 
     // _____________________________ Transmittance + Tint ________________________________
@@ -1144,7 +1148,7 @@ void main(void) {
         // Full value needed for alpha.
         vec3 finalClearCoatScaled = finalClearCoat * vLightingIntensity.x * vLightingIntensity.w;
         #if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)
-            finalClearCoatScaled *= energyConservationFactor;
+            finalClearCoatScaled *= energyConservationFactorClearCoat;
         #endif
 
     // ____________________________ Clear Coat Radiance _______________________________