Skip to content

Commit

Permalink
honor the physicallyCorrectLights flag when using a light map (#22397)
Browse files Browse the repository at this point in the history
  • Loading branch information
WestLangley authored Aug 23, 2021
1 parent d1541fb commit f65415c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js
Original file line number Diff line number Diff line change
@@ -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
`;
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f65415c

Please sign in to comment.