Jelajahi Sumber

Fix when two sided lighting used

Popov72 5 tahun lalu
induk
melakukan
8311bda01f
1 mengubah file dengan 5 tambahan dan 1 penghapusan
  1. 5 1
      src/Shaders/pbr.fragment.fx

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

@@ -66,9 +66,13 @@ void main(void) {
 
     vec3 geometricNormalW = normalW;
 
+#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)
+    geometricNormalW = gl_FrontFacing ? geometricNormalW : -geometricNormalW;
+#endif
+
 #ifdef CLEARCOAT
     // Needs to use the geometric normal before bump for this.
-    vec3 clearCoatNormalW = normalW;
+    vec3 clearCoatNormalW = geometricNormalW;
 #endif
 
 #include<bumpFragment>