소스 검색

Using lightmap encoding everywhere lightMap is used in glsl

Benjamin MICHEL 6 년 전
부모
커밋
b314f78de9
2개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 1
      src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js
  2. 3 2
      src/renderers/shaders/ShaderLib/meshbasic_frag.glsl.js

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

@@ -3,7 +3,8 @@ export default /* glsl */`
 
 	#ifdef USE_LIGHTMAP
 
-		vec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
+		vec4 lightMapTexel= texture2D( lightMap, vUv2 );
+		vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
 
 		#ifndef PHYSICALLY_CORRECT_LIGHTS
 

+ 3 - 2
src/renderers/shaders/ShaderLib/meshbasic_frag.glsl.js

@@ -41,8 +41,9 @@ void main() {
 
 	// accumulation (baked indirect lighting only)
 	#ifdef USE_LIGHTMAP
-
-		reflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
+	
+		vec4 lightMapTexel= texture2D( lightMap, vUv2 );
+		reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
 
 	#else