Browse Source

Editor: Added background color support to pathtracer.

Mr.doob 1 year ago
parent
commit
e06a8b3d3d
1 changed files with 20 additions and 0 deletions
  1. 20 0
      editor/js/Viewport.Pathtracer.js

+ 20 - 0
editor/js/Viewport.Pathtracer.js

@@ -60,6 +60,26 @@ function ViewportPathtracer( renderer ) {
 		ptMaterial.materials.updateFrom( materials, textures );
 		ptMaterial.lights.updateFrom( lights );
 
+		//
+
+		const background = scene.background;
+
+		if ( background ) {
+
+			if ( background.isColor ) {
+
+				ptMaterial.backgroundMap = buildColorTexture( background );
+
+			}
+
+		} else {
+
+			ptMaterial.backgroundMap = buildColorTexture( new THREE.Color( 0x000000 ) );
+
+		}
+
+		//
+
 		const environment = scene.environment;
 
 		if ( environment && environment.isTexture === true ) {