ソースを参照

Fix bug in PBR when specific combinations of parameters are used

Popov72 5 年 前
コミット
5771597f04
2 ファイル変更3 行追加3 行削除
  1. 1 0
      dist/preview release/what's new.md
  2. 2 3
      src/Shaders/pbr.fragment.fx

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

@@ -84,5 +84,6 @@
 - Fixed delay calculation in Animatable.goToFrame when speedRatio != 1 ([Reimund Järnfors](https://github.com/reimund)
 - Fix bug in PBR when translucency is enabled and an irradiance texture is provided ([Popov72](https://github.com/Popov72)
 - Fix bug in PBR with translucency when irradiance texture is 2D ([Popov72](https://github.com/Popov72)
+- Fix bug in PBR when specific combinations of parameters are used ([Popov72](https://github.com/Popov72)
 
 ## Breaking changes

+ 2 - 3
src/Shaders/pbr.fragment.fx

@@ -170,6 +170,7 @@ void main(void) {
     // _____________________________ Reflectivity Info _______________________________
     float microSurface = vReflectivityColor.a;
     vec3 surfaceReflectivityColor = vReflectivityColor.rgb;
+    vec3 baseColor = surfaceAlbedo;
 
     #ifdef METALLICWORKFLOW
         vec2 metallicRoughness = surfaceReflectivityColor.rg;
@@ -208,8 +209,6 @@ void main(void) {
         microSurface = 1.0 - metallicRoughness.g;
 
         // Diffuse is used as the base of the reflectivity.
-        vec3 baseColor = surfaceAlbedo;
-
         #ifdef REFLECTANCE
             // *** NOT USED ANYMORE ***
             // Following Frostbite Remapping,
@@ -740,7 +739,7 @@ void main(void) {
             #if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)
                 float clearCoatReflectionLOD = getLodFromAlphaG(vReflectionMicrosurfaceInfos.x, clearCoatAlphaG, clearCoatNdotVUnclamped);
             #elif defined(LINEARSPECULARREFLECTION)
-                float sheenReflectionLOD = getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x, clearCoatRoughness);
+                float clearCoatReflectionLOD = getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x, clearCoatRoughness);
             #else
                 float clearCoatReflectionLOD = getLodFromAlphaG(vReflectionMicrosurfaceInfos.x, clearCoatAlphaG);
             #endif