Просмотр исходного кода

PMREMGenerator: Fix black HDRIs when processing textures of different sizes (#32310)

mrdoob 1 месяц назад
Родитель
Сommit
a0944f94b8
2 измененных файлов с 2 добавлено и 15 удалено
  1. 1 8
      src/extras/PMREMGenerator.js
  2. 1 7
      src/renderers/common/extras/PMREMGenerator.js

+ 1 - 8
src/extras/PMREMGenerator.js

@@ -314,6 +314,7 @@ class PMREMGenerator {
 			( { lodMeshes: this._lodMeshes, sizeLods: this._sizeLods, sigmas: this._sigmas } = _createPlanes( _lodMax ) );
 
 			this._blurMaterial = _getBlurShader( _lodMax, width, height );
+			this._ggxMaterial = _getGGXShader( _lodMax, width, height );
 
 		}
 
@@ -519,14 +520,6 @@ class PMREMGenerator {
 		const renderer = this._renderer;
 		const pingPongRenderTarget = this._pingPongRenderTarget;
 
-		if ( this._ggxMaterial === null ) {
-
-			const width = 3 * Math.max( this._cubeSize, 16 );
-			const height = 4 * this._cubeSize;
-			this._ggxMaterial = _getGGXShader( this._lodMax, width, height );
-
-		}
-
 		const ggxMaterial = this._ggxMaterial;
 		const ggxMesh = this._lodMeshes[ lodOut ];
 		ggxMesh.material = ggxMaterial;

+ 1 - 7
src/renderers/common/extras/PMREMGenerator.js

@@ -459,6 +459,7 @@ class PMREMGenerator {
 			( { lodMeshes: this._lodMeshes, sizeLods: this._sizeLods, sigmas: this._sigmas } = _createPlanes( _lodMax ) );
 
 			this._blurMaterial = _getBlurShader( _lodMax, renderTarget.width, renderTarget.height );
+			this._ggxMaterial = _getGGXShader( _lodMax, renderTarget.width, renderTarget.height );
 
 		}
 
@@ -650,13 +651,6 @@ class PMREMGenerator {
 		const renderer = this._renderer;
 		const pingPongRenderTarget = this._pingPongRenderTarget;
 
-		// Lazy create GGX material only when first used
-		if ( this._ggxMaterial === null ) {
-
-			this._ggxMaterial = _getGGXShader( this._lodMax, this._pingPongRenderTarget.width, this._pingPongRenderTarget.height );
-
-		}
-
 		const ggxMaterial = this._ggxMaterial;
 		const ggxMesh = this._lodMeshes[ lodOut ];
 		ggxMesh.material = ggxMaterial;

粤ICP备19079148号