瀏覽代碼

Editor: Fixed pathtracer background blurriness. (#27852)

mrdoob 1 年之前
父節點
當前提交
6f0ad3625b
共有 2 個文件被更改,包括 8 次插入7 次删除
  1. 7 6
      editor/js/Viewport.Pathtracer.js
  2. 1 1
      editor/js/Viewport.js

+ 7 - 6
editor/js/Viewport.Pathtracer.js

@@ -49,7 +49,6 @@ function ViewportPathtracer( renderer ) {
 
 		}
 
-		pathtracer.material.backgroundBlur = scene.backgroundBlurriness;
 		pathtracer.reset();
 
 		const { bvh, textures, materials, lights } = generator.generate( scene );
@@ -72,10 +71,7 @@ function ViewportPathtracer( renderer ) {
 
 		//
 
-		setBackground( scene.background );
-
-		//
-
+		setBackground( scene.background, scene.backgroundBlurriness );
 		setEnvironment( scene.environment );
 
 	}
@@ -89,26 +85,30 @@ function ViewportPathtracer( renderer ) {
 
 	}
 
-	function setBackground( background ) {
+	function setBackground( background, blurriness ) {
 
 		if ( pathtracer === null ) return;
 
 		const ptMaterial = pathtracer.material;
+
 		if ( background ) {
 
 			if ( background.isTexture ) {
 
 				ptMaterial.backgroundMap = background;
+				ptMaterial.backgroundBlur = blurriness;
 
 			} else if ( background.isColor ) {
 
 				ptMaterial.backgroundMap = buildColorTexture( background );
+				ptMaterial.backgroundBlur = 0;
 
 			}
 
 		} else {
 
 			ptMaterial.backgroundMap = buildColorTexture( new THREE.Color( 0 ) );
+			ptMaterial.backgroundBlur = 0;
 
 		}
 
@@ -121,6 +121,7 @@ function ViewportPathtracer( renderer ) {
 		if ( pathtracer === null ) return;
 
 		const ptMaterial = pathtracer.material;
+
 		if ( environment && environment.isDataTexture === true ) {
 
 			// Avoid calling envMapInfo() with the same hdr

+ 1 - 1
editor/js/Viewport.js

@@ -758,7 +758,7 @@ function Viewport( editor ) {
 
 		if ( editor.viewportShading === 'realistic' ) {
 
-			pathtracer.setBackground( scene.background );
+			pathtracer.setBackground( scene.background, scene.backgroundBlurriness );
 
 		}