소스 검색

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 );