Sfoglia il codice sorgente

LightProbeGrid: Rename to LightProbeGridWebGL. (#33911)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mrdoob 1 settimana fa
parent
commit
9db79b8bf5

+ 8 - 8
examples/jsm/helpers/LightProbeGridHelper.js → examples/jsm/helpers/LightProbeGridHelperWebGL.js

@@ -8,25 +8,25 @@ import {
 } from 'three';
 
 /**
- * Visualizes an {@link LightProbeGrid} by rendering a sphere at each
+ * Visualizes an {@link LightProbeGridWebGL} by rendering a sphere at each
  * probe position, shaded with the probe's L2 spherical harmonics.
  *
  * Uses a single `InstancedMesh` draw call for all probes.
  *
  * ```js
- * const helper = new LightProbeGridHelper( probes );
+ * const helper = new LightProbeGridHelperWebGL( probes );
  * scene.add( helper );
  * ```
  *
  * @augments InstancedMesh
- * @three_import import { LightProbeGridHelper } from 'three/addons/helpers/LightProbeGridHelper.js';
+ * @three_import import { LightProbeGridHelperWebGL } from 'three/addons/helpers/LightProbeGridHelperWebGL.js';
  */
-class LightProbeGridHelper extends InstancedMesh {
+class LightProbeGridHelperWebGL extends InstancedMesh {
 
 	/**
 	 * Constructs a new irradiance probe grid helper.
 	 *
-	 * @param {LightProbeGrid} probes - The probe grid to visualize.
+	 * @param {LightProbeGridWebGL} probes - The probe grid to visualize.
 	 * @param {number} [sphereSize=0.12] - The radius of each probe sphere.
 	 */
 	constructor( probes, sphereSize = 0.12 ) {
@@ -135,11 +135,11 @@ class LightProbeGridHelper extends InstancedMesh {
 		/**
 		 * The probe grid to visualize.
 		 *
-		 * @type {LightProbeGrid}
+		 * @type {LightProbeGridWebGL}
 		 */
 		this.probes = probes;
 
-		this.type = 'LightProbeGridHelper';
+		this.type = 'LightProbeGridHelperWebGL';
 
 		this.update();
 
@@ -218,4 +218,4 @@ class LightProbeGridHelper extends InstancedMesh {
 
 }
 
-export { LightProbeGridHelper };
+export { LightProbeGridHelperWebGL };

+ 5 - 5
examples/jsm/lighting/LightProbeGrid.js → examples/jsm/lighting/LightProbeGridWebGL.js

@@ -78,9 +78,9 @@ const ATLAS_PADDING = 1;
  * Baking is fully GPU-resident: cubemap rendering, SH projection, and
  * texture packing all happen on the GPU with zero CPU readback.
  *
- * @three_import import { LightProbeGrid } from 'three/addons/lighting/LightProbeGrid.js';
+ * @three_import import { LightProbeGridWebGL } from 'three/addons/lighting/LightProbeGridWebGL.js';
  */
-class LightProbeGrid extends Object3D {
+class LightProbeGridWebGL extends Object3D {
 
 	/**
 	 * Constructs a new irradiance probe grid.
@@ -141,7 +141,7 @@ class LightProbeGrid extends Object3D {
 
 		/**
 		 * The world-space bounding box for the grid. Updated automatically
-		 * by {@link LightProbeGrid#bake}.
+		 * by {@link LightProbeGridWebGL#bake}.
 		 *
 		 * @type {Box3}
 		 */
@@ -362,7 +362,7 @@ class LightProbeGrid extends Object3D {
 
 		scene.matrixWorldAutoUpdate = currentMatrixWorldAutoUpdate;
 
-		// console.log( `LightProbeGrid: bake complete ${ ( performance.now() - t0 ).toFixed( 1 ) }ms` );
+		// console.log( `LightProbeGridWebGL: bake complete ${ ( performance.now() - t0 ).toFixed( 1 ) }ms` );
 
 		this.visible = true;
 
@@ -678,4 +678,4 @@ function _ensureBatchTarget( totalProbes ) {
 
 }
 
-export { LightProbeGrid };
+export { LightProbeGridWebGL };

BIN
examples/screenshots/webgl_lightprobes.jpg


+ 7 - 11
examples/webgl_lightprobes.html

@@ -32,8 +32,8 @@
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
-			import { LightProbeGrid } from 'three/addons/lighting/LightProbeGrid.js';
-			import { LightProbeGridHelper } from 'three/addons/helpers/LightProbeGridHelper.js';
+			import { LightProbeGridWebGL } from 'three/addons/lighting/LightProbeGridWebGL.js';
+			import { LightProbeGridHelperWebGL } from 'three/addons/helpers/LightProbeGridHelperWebGL.js';
 
 			let camera, scene, renderer, controls;
 			let probes, probesHelper;
@@ -134,10 +134,6 @@
 				light.shadow.normalBias = - 0.02;
 				scene.add( light );
 
-				// Dim ambient to see GI effect better
-				const ambient = new THREE.AmbientLight( 0xffffff, 0.05 );
-				scene.add( ambient );
-
 				// Renderer
 
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
@@ -157,7 +153,7 @@
 
 				// Bake light probe volume
 
-				async function bakeWithResolution( resolution ) {
+				async function bake( resolution ) {
 
 					if ( probes ) {
 
@@ -166,7 +162,7 @@
 
 					}
 
-					probes = new LightProbeGrid( 5.6, 4.7, 5.6, resolution, resolution, resolution );
+					probes = new LightProbeGridWebGL( 5.6, 4.7, 5.6, resolution, resolution, resolution );
 					probes.position.set( 0, 2.45, 0 );
 					probes.bake( renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 } );
 					probes.visible = params.enabled;
@@ -176,7 +172,7 @@
 
 					if ( ! probesHelper ) {
 
-						probesHelper = new LightProbeGridHelper( probes );
+						probesHelper = new LightProbeGridHelperWebGL( probes );
 						probesHelper.visible = params.showProbes;
 						scene.add( probesHelper );
 
@@ -195,7 +191,7 @@
 					resolution: 6
 				};
 
-				await bakeWithResolution( params.resolution );
+				await bake( params.resolution );
 
 				// GUI
 
@@ -207,7 +203,7 @@
 				} );
 				gui.add( params, 'resolution', 2, 12, 1 ).name( 'Resolution' ).onFinishChange( ( value ) => {
 
-					bakeWithResolution( value );
+					bake( value );
 
 				} );
 				gui.add( params, 'showProbes' ).name( 'Show Probes' ).onChange( ( value ) => {

+ 9 - 9
examples/webgl_lightprobes_complex.html

@@ -32,8 +32,8 @@
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
-			import { LightProbeGrid } from 'three/addons/lighting/LightProbeGrid.js';
-			import { LightProbeGridHelper } from 'three/addons/helpers/LightProbeGridHelper.js';
+			import { LightProbeGridWebGL } from 'three/addons/lighting/LightProbeGridWebGL.js';
+			import { LightProbeGridHelperWebGL } from 'three/addons/helpers/LightProbeGridHelperWebGL.js';
 
 			let camera, scene, renderer, controls;
 			let probesLeft, probesRight;
@@ -279,7 +279,7 @@
 					resolution: 6
 				};
 
-				async function bakeWithResolution( resolution ) {
+				async function bake( resolution ) {
 
 					// Remove both volumes before baking to prevent feedback
 
@@ -299,12 +299,12 @@
 
 					// Bake both volumes
 
-					probesLeft = new LightProbeGrid( 7.8, 4.7, 7.6, resolution, resolution, resolution );
+					probesLeft = new LightProbeGridWebGL( 7.8, 4.7, 7.6, resolution, resolution, resolution );
 					probesLeft.position.set( - 3.9, 2.45, 0 );
 					probesLeft.bake( renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 } );
 					probesLeft.visible = params.enabled;
 
-					probesRight = new LightProbeGrid( 7.8, 4.7, 7.6, resolution, resolution, resolution );
+					probesRight = new LightProbeGridWebGL( 7.8, 4.7, 7.6, resolution, resolution, resolution );
 					probesRight.position.set( 3.9, 2.45, 0 );
 					probesRight.bake( renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 } );
 					probesRight.visible = params.enabled;
@@ -318,11 +318,11 @@
 
 					if ( ! probesHelperLeft ) {
 
-						probesHelperLeft = new LightProbeGridHelper( probesLeft );
+						probesHelperLeft = new LightProbeGridHelperWebGL( probesLeft );
 						probesHelperLeft.visible = params.showProbes;
 						scene.add( probesHelperLeft );
 
-						probesHelperRight = new LightProbeGridHelper( probesRight );
+						probesHelperRight = new LightProbeGridHelperWebGL( probesRight );
 						probesHelperRight.visible = params.showProbes;
 						scene.add( probesHelperRight );
 
@@ -338,7 +338,7 @@
 
 				}
 
-				await bakeWithResolution( params.resolution );
+				await bake( params.resolution );
 
 				// GUI
 
@@ -351,7 +351,7 @@
 				} );
 				gui.add( params, 'resolution', 2, 12, 1 ).name( 'Resolution' ).onFinishChange( ( value ) => {
 
-					bakeWithResolution( value );
+					bake( value );
 
 				} );
 				gui.add( params, 'showProbes' ).name( 'Show Probes' ).onChange( ( value ) => {

+ 5 - 5
examples/webgl_lightprobes_sponza.html

@@ -36,8 +36,8 @@
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 			import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
 			import { Sky } from 'three/addons/objects/Sky.js';
-			import { LightProbeGrid } from 'three/addons/lighting/LightProbeGrid.js';
-			import { LightProbeGridHelper } from 'three/addons/helpers/LightProbeGridHelper.js';
+			import { LightProbeGridWebGL } from 'three/addons/lighting/LightProbeGridWebGL.js';
+			import { LightProbeGridHelperWebGL } from 'three/addons/helpers/LightProbeGridHelperWebGL.js';
 
 			const MODEL_INDEX_URL = 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/model-index.json';
 			const SAMPLE_ASSETS_BASE_URL = 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/';
@@ -233,7 +233,7 @@
 
 						}
 
-						probes = new LightProbeGrid(
+						probes = new LightProbeGridWebGL(
 							params.sizeX, params.sizeY, params.sizeZ,
 							params.countX, params.countY, params.countZ
 						);
@@ -252,7 +252,7 @@
 
 						if ( ! probesHelper ) {
 
-							probesHelper = new LightProbeGridHelper( probes, params.probeSize );
+							probesHelper = new LightProbeGridHelperWebGL( probes, params.probeSize );
 							probesHelper.visible = params.showProbes;
 							scene.add( probesHelper );
 
@@ -320,7 +320,7 @@
 
 						scene.remove( probesHelper );
 						probesHelper.dispose();
-						probesHelper = new LightProbeGridHelper( probes, value );
+						probesHelper = new LightProbeGridHelperWebGL( probes, value );
 						probesHelper.visible = params.showProbes;
 						scene.add( probesHelper );
 

粤ICP备19079148号