Browse Source

Merge pull request #7674 from Popov72/pbr-sheen-bug

Fix bug in PBR sheen direct lighting
David Catuhe 5 năm trước cách đây
mục cha
commit
b713df5a77

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

@@ -345,6 +345,7 @@
 - Fix `HDRCubeTexture` construction, `generateHarmonics` was not properly taken into account ([Popov72](https://github.com/Popov72))
 - VideoTexture poster respects invertY ([Sebavan](https://github.com/sebavan/)
 - Fix for bug where round-tripped glTF imported scenes have incorrect light orientation, and duplicated parent nodes ([#7377](https://github.com/BabylonJS/Babylon.js/issues/7377))([drigax](https://github.com/drigax))
+- Fix bug in PBR sheen where the sheen effect could be a little darker than expected when using direct lighting ([Popov72](https://github.com/Popov72)
 - Fix bug in PBR shader when `reflectionTexture.linearSpecularLOD` is `true`  ([Popov72](https://github.com/Popov72))
 
 ## Breaking changes

+ 2 - 2
src/Shaders/ShadersInclude/pbrDirectLightingFunctions.fx

@@ -141,11 +141,11 @@ vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler, m
 
         // No Fresnel Effect with sheen
         // vec3 fresnel = fresnelSchlickGGX(info.VdotH, reflectance0, reflectance90);
-        vec3 fresnel = reflectance0;
+        float fresnel = 1.;
         float distribution = normalDistributionFunction_CharlieSheen(NdotH, alphaG);
         float ashikhminvisibility = visibility_Ashikhmin(info.NdotL, info.NdotV);
 
-        vec3 sheenTerm = fresnel * distribution * ashikhminvisibility;
+        float sheenTerm = fresnel * distribution * ashikhminvisibility;
         return sheenTerm * info.attenuation * info.NdotL * lightColor;
     }
 #endif