Explorar o código

Fix when two sided lighting used

Popov72 %!s(int64=5) %!d(string=hai) anos
pai
achega
8311bda01f
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  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>