浏览代码

Fix when two sided lighting used

Popov72 5 年之前
父节点
当前提交
8311bda01f
共有 1 个文件被更改,包括 5 次插入1 次删除
  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>