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

Examples: Added helpers to light probe examples (#29309)

* Add helper

* Update screenshot
WestLangley 1 год назад
Родитель
Сommit
b304349d49

BIN
examples/screenshots/webgl_lightprobe.jpg


+ 9 - 0
examples/webgl_lightprobe.html

@@ -28,8 +28,11 @@
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
+
 			import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js';
 
+			import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelper.js';
+
 			let mesh, renderer, scene, camera;
 
 			let gui;
@@ -99,6 +102,8 @@
 					scene.background = cubeTexture;
 
 					lightProbe.copy( LightProbeGenerator.fromCubeTexture( cubeTexture ) );
+					lightProbe.intensity = API.lightProbeIntensity;
+					lightProbe.position.set( - 10, 0, 0 ); // position not used in scene lighting calculations (helper honors the position, however)
 
 					const geometry = new THREE.SphereGeometry( 5, 64, 32 );
 					//const geometry = new THREE.TorusKnotGeometry( 4, 1.5, 256, 32, 2, 3 );
@@ -115,6 +120,10 @@
 					mesh = new THREE.Mesh( geometry, material );
 					scene.add( mesh );
 
+					// helper
+					const helper = new LightProbeHelper( lightProbe, 1 );
+					scene.add( helper );
+
 					render();
 
 				} );

+ 9 - 0
examples/webgpu_lightprobe.html

@@ -29,8 +29,11 @@
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
+
 			import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js';
 
+			import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelperGPU.js';
+
 			let mesh, renderer, scene, camera;
 
 			let gui;
@@ -100,6 +103,8 @@
 					scene.background = cubeTexture;
 
 					lightProbe.copy( LightProbeGenerator.fromCubeTexture( cubeTexture ) );
+					lightProbe.intensity = API.lightProbeIntensity;
+					lightProbe.position.set( - 10, 0, 0 ); // position not used in scene lighting calculations (helper honors the position, however)
 
 					const geometry = new THREE.SphereGeometry( 5, 64, 32 );
 					//const geometry = new THREE.TorusKnotGeometry( 4, 1.5, 256, 32, 2, 3 );
@@ -116,6 +121,10 @@
 					mesh = new THREE.Mesh( geometry, material );
 					scene.add( mesh );
 
+					// helper
+					const helper = new LightProbeHelper( lightProbe, 1 );
+					scene.add( helper );
+
 				} );
 
 

粤ICP备19079148号