浏览代码

WebGLRenderer: Only use sRGB shader encode for default framebuffer. (#23253)

Michael Herzog 3 年之前
父节点
当前提交
63f7bebed6
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      src/renderers/WebGLRenderer.js
  2. 2 2
      src/renderers/webgl/WebGLPrograms.js

+ 1 - 1
src/renderers/WebGLRenderer.js

@@ -1415,7 +1415,7 @@ function WebGLRenderer( parameters = {} ) {
 
 
 		const fog = scene.fog;
 		const fog = scene.fog;
 		const environment = material.isMeshStandardMaterial ? scene.environment : null;
 		const environment = material.isMeshStandardMaterial ? scene.environment : null;
-		const encoding = ( _currentRenderTarget === null ) ? _this.outputEncoding : _currentRenderTarget.texture.encoding;
+		const encoding = ( _currentRenderTarget === null ) ? _this.outputEncoding : LinearEncoding;
 		const envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );
 		const envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );
 		const vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;
 		const vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;
 		const vertexTangents = !! material.normalMap && !! geometry.attributes.tangent;
 		const vertexTangents = !! material.normalMap && !! geometry.attributes.tangent;

+ 2 - 2
src/renderers/webgl/WebGLPrograms.js

@@ -1,4 +1,4 @@
-import { BackSide, DoubleSide, CubeUVRefractionMapping, CubeUVReflectionMapping, ObjectSpaceNormalMap, TangentSpaceNormalMap, NoToneMapping, sRGBEncoding } from '../../constants.js';
+import { BackSide, DoubleSide, CubeUVRefractionMapping, CubeUVReflectionMapping, ObjectSpaceNormalMap, TangentSpaceNormalMap, NoToneMapping, LinearEncoding, sRGBEncoding } from '../../constants.js';
 import { Layers } from '../../core/Layers.js';
 import { Layers } from '../../core/Layers.js';
 import { WebGLProgram } from './WebGLProgram.js';
 import { WebGLProgram } from './WebGLProgram.js';
 import { WebGLShaderCache } from './WebGLShaderCache.js';
 import { WebGLShaderCache } from './WebGLShaderCache.js';
@@ -148,7 +148,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
 			instancingColor: object.isInstancedMesh === true && object.instanceColor !== null,
 			instancingColor: object.isInstancedMesh === true && object.instanceColor !== null,
 
 
 			supportsVertexTextures: vertexTextures,
 			supportsVertexTextures: vertexTextures,
-			outputEncoding: ( currentRenderTarget !== null ) ? currentRenderTarget.texture.encoding : renderer.outputEncoding,
+			outputEncoding: ( currentRenderTarget === null ) ? renderer.outputEncoding : LinearEncoding,
 			map: !! material.map,
 			map: !! material.map,
 			matcap: !! material.matcap,
 			matcap: !! material.matcap,
 			envMap: !! envMap,
 			envMap: !! envMap,