Skip to content

Commit 6f0ad36

Browse files
authored
Editor: Fixed pathtracer background blurriness. (#27852)
1 parent c3fb29d commit 6f0ad36

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

editor/js/Viewport.Pathtracer.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ function ViewportPathtracer( renderer ) {
4949

5050
}
5151

52-
pathtracer.material.backgroundBlur = scene.backgroundBlurriness;
5352
pathtracer.reset();
5453

5554
const { bvh, textures, materials, lights } = generator.generate( scene );
@@ -72,10 +71,7 @@ function ViewportPathtracer( renderer ) {
7271

7372
//
7473

75-
setBackground( scene.background );
76-
77-
//
78-
74+
setBackground( scene.background, scene.backgroundBlurriness );
7975
setEnvironment( scene.environment );
8076

8177
}
@@ -89,26 +85,30 @@ function ViewportPathtracer( renderer ) {
8985

9086
}
9187

92-
function setBackground( background ) {
88+
function setBackground( background, blurriness ) {
9389

9490
if ( pathtracer === null ) return;
9591

9692
const ptMaterial = pathtracer.material;
93+
9794
if ( background ) {
9895

9996
if ( background.isTexture ) {
10097

10198
ptMaterial.backgroundMap = background;
99+
ptMaterial.backgroundBlur = blurriness;
102100

103101
} else if ( background.isColor ) {
104102

105103
ptMaterial.backgroundMap = buildColorTexture( background );
104+
ptMaterial.backgroundBlur = 0;
106105

107106
}
108107

109108
} else {
110109

111110
ptMaterial.backgroundMap = buildColorTexture( new THREE.Color( 0 ) );
111+
ptMaterial.backgroundBlur = 0;
112112

113113
}
114114

@@ -121,6 +121,7 @@ function ViewportPathtracer( renderer ) {
121121
if ( pathtracer === null ) return;
122122

123123
const ptMaterial = pathtracer.material;
124+
124125
if ( environment && environment.isDataTexture === true ) {
125126

126127
// Avoid calling envMapInfo() with the same hdr

editor/js/Viewport.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ function Viewport( editor ) {
758758

759759
if ( editor.viewportShading === 'realistic' ) {
760760

761-
pathtracer.setBackground( scene.background );
761+
pathtracer.setBackground( scene.background, scene.backgroundBlurriness );
762762

763763
}
764764

0 commit comments

Comments
 (0)