Explorar o código

honor the physicallyCorrectLights flag when using a light map (#22397)

WestLangley %!s(int64=3) %!d(string=hai) anos
pai
achega
f65415c8f7

+ 10 - 2
src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js

@@ -1,8 +1,16 @@
 export default /* glsl */`
 #ifdef USE_LIGHTMAP
 
-	vec4 lightMapTexel= texture2D( lightMap, vUv2 );
-	reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity; // factor of PI should not be present; included here to prevent breakage
+	vec4 lightMapTexel = texture2D( lightMap, vUv2 );
+	vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
+
+	#ifndef PHYSICALLY_CORRECT_LIGHTS
+
+		lightMapIrradiance *= PI;
+
+	#endif
+
+	reflectedLight.indirectDiffuse += lightMapIrradiance;
 
 #endif
 `;

+ 2 - 2
src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js

@@ -3,12 +3,12 @@ export default /* glsl */`
 
 	#ifdef USE_LIGHTMAP
 
-		vec4 lightMapTexel= texture2D( lightMap, vUv2 );
+		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
 		vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
 
 		#ifndef PHYSICALLY_CORRECT_LIGHTS
 
-			lightMapIrradiance *= PI; // factor of PI should not be present; included here to prevent breakage
+			lightMapIrradiance *= PI;
 
 		#endif