Skip to content

Commit a0944f9

Browse files
authored
PMREMGenerator: Fix black HDRIs when processing textures of different sizes (#32310)
1 parent 701c52e commit a0944f9

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

src/extras/PMREMGenerator.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ class PMREMGenerator {
314314
( { lodMeshes: this._lodMeshes, sizeLods: this._sizeLods, sigmas: this._sigmas } = _createPlanes( _lodMax ) );
315315

316316
this._blurMaterial = _getBlurShader( _lodMax, width, height );
317+
this._ggxMaterial = _getGGXShader( _lodMax, width, height );
317318

318319
}
319320

@@ -519,14 +520,6 @@ class PMREMGenerator {
519520
const renderer = this._renderer;
520521
const pingPongRenderTarget = this._pingPongRenderTarget;
521522

522-
if ( this._ggxMaterial === null ) {
523-
524-
const width = 3 * Math.max( this._cubeSize, 16 );
525-
const height = 4 * this._cubeSize;
526-
this._ggxMaterial = _getGGXShader( this._lodMax, width, height );
527-
528-
}
529-
530523
const ggxMaterial = this._ggxMaterial;
531524
const ggxMesh = this._lodMeshes[ lodOut ];
532525
ggxMesh.material = ggxMaterial;

src/renderers/common/extras/PMREMGenerator.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ class PMREMGenerator {
459459
( { lodMeshes: this._lodMeshes, sizeLods: this._sizeLods, sigmas: this._sigmas } = _createPlanes( _lodMax ) );
460460

461461
this._blurMaterial = _getBlurShader( _lodMax, renderTarget.width, renderTarget.height );
462+
this._ggxMaterial = _getGGXShader( _lodMax, renderTarget.width, renderTarget.height );
462463

463464
}
464465

@@ -650,13 +651,6 @@ class PMREMGenerator {
650651
const renderer = this._renderer;
651652
const pingPongRenderTarget = this._pingPongRenderTarget;
652653

653-
// Lazy create GGX material only when first used
654-
if ( this._ggxMaterial === null ) {
655-
656-
this._ggxMaterial = _getGGXShader( this._lodMax, this._pingPongRenderTarget.width, this._pingPongRenderTarget.height );
657-
658-
}
659-
660654
const ggxMaterial = this._ggxMaterial;
661655
const ggxMesh = this._lodMeshes[ lodOut ];
662656
ggxMesh.material = ggxMaterial;

0 commit comments

Comments
 (0)