浏览代码

Merge pull request #7764 from Popov72/clearcoat

PBR: Update the energy conservation factor for the clear coat layer
sebavan 5 年之前
父节点
当前提交
0593d5a4bf
共有 2 个文件被更改,包括 6 次插入1 次删除
  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 _______________________________