浏览代码

Renderer: `backgroundIntensity` is not working (#27918)

* Renderer: `backgroundIntensity` is not working

* revision

---------

Co-authored-by: sunag <[email protected]>
susiwen8 1 年之前
父节点
当前提交
107efce7e5
共有 2 个文件被更改,包括 15 次插入1 次删除
  1. 1 1
      examples/jsm/renderers/common/Background.js
  2. 14 0
      examples/webgpu_equirectangular.html

+ 1 - 1
examples/jsm/renderers/common/Background.js

@@ -83,7 +83,7 @@ class Background extends DataMap {
 
 			if ( sceneData.backgroundCacheKey !== backgroundCacheKey ) {
 
-				sceneData.backgroundMeshNode.node = vec4( backgroundNode );
+				sceneData.backgroundMeshNode.node = vec4( backgroundNode ).mul( backgroundIntensity );
 
 				backgroundMesh.material.needsUpdate = true;
 

+ 14 - 0
examples/webgpu_equirectangular.html

@@ -26,6 +26,7 @@
 
 			import * as THREE from 'three';
 			import { texture, equirectUV } from 'three/nodes';
+			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 
 			import WebGPU from 'three/addons/capabilities/WebGPU.js';
 			import WebGL from 'three/addons/capabilities/WebGL.js';
@@ -92,6 +93,19 @@
 
 			}
 
+			const gui = new GUI();
+
+			const params = {
+				intensity: 1.0,
+			};
+			gui.add( params, 'intensity', 0, 1 ).onChange( function ( value ) {
+
+				scene.backgroundIntensity = value;
+				render();
+
+			} );
+
+
 		</script>
 
 	</body>