Просмотр исходного кода

NodeMaterialObserver: Fix missing intensity uniform updates. (#31120)

Michael Herzog 9 месяцев назад
Родитель
Сommit
5bf53eec78
2 измененных файлов с 23 добавлено и 6 удалено
  1. 19 6
      examples/webgpu_materials_lightmap.html
  2. 4 0
      src/materials/nodes/manager/NodeMaterialObserver.js

+ 19 - 6
examples/webgpu_materials_lightmap.html

@@ -24,13 +24,17 @@
 			import * as THREE from 'three';
 			import * as THREE from 'three';
 			import { vec4, color, positionLocal, mix } from 'three/tsl';
 			import { vec4, color, positionLocal, mix } from 'three/tsl';
 
 
-			import Stats from 'three/addons/libs/stats.module.js';
+			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 
 
-			let container, stats;
+			let container;
 			let camera, scene, renderer;
 			let camera, scene, renderer;
 
 
+			const params = {
+				intensity: 1
+			};
+
 			init();
 			init();
 
 
 			async function init() {
 			async function init() {
@@ -93,10 +97,20 @@
 				controls.maxPolarAngle = 0.9 * Math.PI / 2;
 				controls.maxPolarAngle = 0.9 * Math.PI / 2;
 				controls.enableZoom = false;
 				controls.enableZoom = false;
 
 
-				// STATS
+				// GUI
+
+				const gui = new GUI();
+
+				gui.add( params, 'intensity', 0, 1 ).name( 'Light Map Intensity' ).onChange( ( value ) => {
+
+					for ( const material of object.material ) {
+
+						material.lightMapIntensity = value;
+
+					}
 
 
-				stats = new Stats();
-				container.appendChild( stats.dom );
+				} );
+				gui.open();
 
 
 				//
 				//
 
 
@@ -118,7 +132,6 @@
 			function animate() {
 			function animate() {
 
 
 				renderer.render( scene, camera );
 				renderer.render( scene, camera );
-				stats.update();
 
 
 			}
 			}
 
 

+ 4 - 0
src/materials/nodes/manager/NodeMaterialObserver.js

@@ -5,6 +5,7 @@ const refreshUniforms = [
 	'anisotropyMap',
 	'anisotropyMap',
 	'anisotropyRotation',
 	'anisotropyRotation',
 	'aoMap',
 	'aoMap',
+	'aoMapIntensity',
 	'attenuationColor',
 	'attenuationColor',
 	'attenuationDistance',
 	'attenuationDistance',
 	'bumpMap',
 	'bumpMap',
@@ -17,8 +18,10 @@ const refreshUniforms = [
 	'dispersion',
 	'dispersion',
 	'displacementMap',
 	'displacementMap',
 	'emissive',
 	'emissive',
+	'emissiveIntensity',
 	'emissiveMap',
 	'emissiveMap',
 	'envMap',
 	'envMap',
+	'envMapIntensity',
 	'gradientMap',
 	'gradientMap',
 	'ior',
 	'ior',
 	'iridescence',
 	'iridescence',
@@ -26,6 +29,7 @@ const refreshUniforms = [
 	'iridescenceMap',
 	'iridescenceMap',
 	'iridescenceThicknessMap',
 	'iridescenceThicknessMap',
 	'lightMap',
 	'lightMap',
+	'lightMapIntensity',
 	'map',
 	'map',
 	'matcap',
 	'matcap',
 	'metalness',
 	'metalness',

粤ICP备19079148号