瀏覽代碼

Fixed rim lighting glitch, closes #13340, closes #13986

Juan Linietsky 7 年之前
父節點
當前提交
e8494f7ab7
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/gles3/shaders/scene.glsl

+ 1 - 1
drivers/gles3/shaders/scene.glsl

@@ -1030,7 +1030,7 @@ LIGHT_SHADER_CODE
 
 
 
 
 #if defined(LIGHT_USE_RIM)
 #if defined(LIGHT_USE_RIM)
-		float rim_light = pow(1.0-cNdotV, (1.0-roughness)*16.0);
+		float rim_light = pow(max(0.0,1.0-cNdotV), max(0.0,(1.0-roughness)*16.0));
 		diffuse_light += rim_light * rim * mix(vec3(1.0),diffuse_color,rim_tint) * light_color;
 		diffuse_light += rim_light * rim * mix(vec3(1.0),diffuse_color,rim_tint) * light_color;
 #endif
 #endif
 	}
 	}