浏览代码

Merge pull request #8347 from bhouston/physical_lights_cutoff_bug

fix minor bug (exp2->pow2) in physical lights attention calculation
Mr.doob 9 年之前
父节点
当前提交
c4d0390ed1
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/renderers/shaders/ShaderChunk/bsdfs.glsl

+ 3 - 2
src/renderers/shaders/ShaderChunk/bsdfs.glsl

@@ -11,11 +11,12 @@ float punctualLightIntensityToIrradianceFactor( const in float lightDistance, co
 #if defined ( PHYSICALLY_CORRECT_LIGHTS )
 
 			// based upon Frostbite 3 Moving to Physically-based Rendering
-			// http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+			// page 32, equation 26: E[window1]
+			// http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr_v2.pdf
 			// this is intended to be used on spot and point lights who are represented as luminous intensity
 			// but who must be converted to luminous irradiance for surface lighting calculation
 			float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
-			float maxDistanceCutoffFactor = exp2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ) ;
+			float maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
 			return distanceFalloff * maxDistanceCutoffFactor;
 
 #else