瀏覽代碼

updated environment lookup vector

Emmett Lalish 6 年之前
父節點
當前提交
aa43b5427b
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js

+ 3 - 0
src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js

@@ -63,6 +63,9 @@ export default /* glsl */ `
 
 		  vec3 reflectVec = reflect( -viewDir, normal );
 
+		  // Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.
+		  reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
+
 		#else
 
 		  vec3 reflectVec = refract( -viewDir, normal, refractionRatio );