Browse Source

updated environment lookup vector

Emmett Lalish 6 years ago
parent
commit
aa43b5427b

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

@@ -63,6 +63,9 @@ export default /* glsl */ `
 
 
 		  vec3 reflectVec = reflect( -viewDir, normal );
 		  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
 		#else
 
 
 		  vec3 reflectVec = refract( -viewDir, normal, refractionRatio );
 		  vec3 reflectVec = refract( -viewDir, normal, refractionRatio );