Skip to content

Commit 36ae025

Browse files
authored
SSRPass: Ensure metalness pass is not affected by fog and background. (#29585)
1 parent 186d7b4 commit 36ae025

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

examples/jsm/postprocessing/SSRPass.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,9 +558,13 @@ class SSRPass extends Pass {
558558
this.originalClearColor.copy( renderer.getClearColor( this.tempColor ) );
559559
const originalClearAlpha = renderer.getClearAlpha( this.tempColor );
560560
const originalAutoClear = renderer.autoClear;
561+
const originalBackground = this.scene.background;
562+
const originalFog = this.scene.fog;
561563

562564
renderer.setRenderTarget( renderTarget );
563565
renderer.autoClear = false;
566+
this.scene.background = null;
567+
this.scene.fog = null;
564568

565569
clearColor = overrideMaterial.clearColor || clearColor;
566570
clearAlpha = overrideMaterial.clearAlpha || clearAlpha;
@@ -599,6 +603,8 @@ class SSRPass extends Pass {
599603
renderer.autoClear = originalAutoClear;
600604
renderer.setClearColor( this.originalClearColor );
601605
renderer.setClearAlpha( originalClearAlpha );
606+
this.scene.background = originalBackground;
607+
this.scene.fog = originalFog;
602608

603609
}
604610

0 commit comments

Comments
 (0)