Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/jsm/Addons.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export * from './modifiers/SimplifyModifier.js';
export * from './modifiers/TessellateModifier.js';

export * from './objects/GroundedSkybox.js';
export * from './objects/GaussianSplatMesh.js';
export * from './objects/GaussianSplat.js';
export * from './objects/Lensflare.js';
export * from './objects/MarchingCubes.js';
export * from './objects/Reflector.js';
Expand Down
12 changes: 6 additions & 6 deletions examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
Group
} from 'three';

import { GaussianSplatMesh } from '../objects/GaussianSplatMesh.js';
import { GaussianSplat } from '../objects/GaussianSplat.js';
import { SH_BAND_WORDS, createGaussianSplatGeometry, createPackedSphericalHarmonicsBand, writeColorBytesFromSH0, writeCovariance } from '../utils/GaussianSplatUtils.js';

const EXTENSION_NAME = 'KHR_gaussian_splatting';
Expand All @@ -14,7 +14,7 @@ const ATTRIBUTES = {
/**
* A glTF loader plugin for `KHR_gaussian_splatting`.
*
* This plugin must be registered explicitly because {@link GaussianSplatMesh}
* This plugin must be registered explicitly because {@link GaussianSplat}
* requires {@link WebGPURenderer}.
*
* ```js
Expand Down Expand Up @@ -46,7 +46,7 @@ class GLTFGaussianSplatLoaderExtension {
* Loads a glTF mesh containing gaussian splat primitives.
*
* @param {number} meshIndex - The mesh index.
* @return {?Promise<Group|GaussianSplatMesh>} The loaded mesh or `null` when the mesh does not use this extension.
* @return {?Promise<Group|GaussianSplat>} The loaded mesh or `null` when the mesh does not use this extension.
*/
loadMesh( meshIndex ) {

Expand Down Expand Up @@ -77,7 +77,7 @@ class GLTFGaussianSplatLoaderExtension {

}

const mesh = createGaussianSplatMesh( geometry, primitive );
const mesh = createGaussianSplat( geometry, primitive );
mesh.name = parser.createUniqueName( meshDef.name || ( 'mesh_' + meshIndex ) );

assignExtrasToUserData( mesh, meshDef );
Expand Down Expand Up @@ -117,7 +117,7 @@ function isGaussianSplatPrimitive( primitiveDef ) {

}

function createGaussianSplatMesh( geometry, primitiveDef ) {
function createGaussianSplat( geometry, primitiveDef ) {

const extensionDef = primitiveDef.extensions[ EXTENSION_NAME ];

Expand Down Expand Up @@ -194,7 +194,7 @@ function createGaussianSplatMesh( geometry, primitiveDef ) {

}

const mesh = new GaussianSplatMesh( createGaussianSplatGeometry( centers, covariances, colors, sphericalHarmonics ) );
const mesh = new GaussianSplat( createGaussianSplatGeometry( centers, covariances, colors, sphericalHarmonics ) );

mesh.userData.gltfExtensions = mesh.userData.gltfExtensions || {};
mesh.userData.gltfExtensions[ EXTENSION_NAME ] = Object.assign( {}, extensionDef );
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/loaders/GaussianSplatPLYLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const _restPropertyPattern = /^f_rest_\d+$/;
* ```js
* const loader = new GaussianSplatPLYLoader();
* const geometry = await loader.loadAsync( './models/gsplat/point_cloud.ply' );
* scene.add( new GaussianSplatMesh( geometry ) );
* scene.add( new GaussianSplat( geometry ) );
* ```
*
* @augments Loader
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/loaders/KSPLATLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ const COMPRESSION_LEVELS = {
* A loader for GaussianSplats3D `.ksplat` files.
*
* This loader decodes the format into `BufferGeometry` for use with
* `GaussianSplatMesh`. Higher-order spherical harmonics are exposed as optional
* `GaussianSplat`. Higher-order spherical harmonics are exposed as optional
* `sphericalHarmonics1` through `sphericalHarmonics3` packed uint32 geometry
* attributes (`SH_BAND_WORDS[ degree ]` words per splat). Coefficients use the
* clamped-byte encoding `( value - 128 ) / 128`, four bytes per word.
*
* ```js
* const loader = new KSPLATLoader();
* const data = await loader.loadAsync( './models/gsplat/example.ksplat' );
* scene.add( new GaussianSplatMesh( data ) );
* scene.add( new GaussianSplat( data ) );
* ```
*
* @augments Loader
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/loaders/SPLATLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ const ROW_SIZE_BYTES = 32;
* A loader for standard fixed-width Gaussian splat `.splat` files.
*
* This loader decodes the format into `BufferGeometry` for use with
* `GaussianSplatMesh`. Each 32-byte row stores center, scale, color and
* `GaussianSplat`. Each 32-byte row stores center, scale, color and
* rotation data for one splat.
*
* ```js
* const loader = new SPLATLoader();
* const data = await loader.loadAsync( './models/gsplat/example.splat' );
* scene.add( new GaussianSplatMesh( data ) );
* scene.add( new GaussianSplat( data ) );
* ```
*
* @augments Loader
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/loaders/SPZLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ const _quaternion = [ 0, 0, 0, 0 ];
* A loader for compressed Gaussian splat `.spz` files.
*
* This loader decodes the format into `BufferGeometry` for use with
* `GaussianSplatMesh`. Higher-order spherical harmonics are exposed as optional
* `GaussianSplat`. Higher-order spherical harmonics are exposed as optional
* `sphericalHarmonics1` through `sphericalHarmonics3` packed uint32 geometry
* attributes (`SH_BAND_WORDS[ degree ]` words per splat). Coefficients use the
* clamped-byte encoding `( value - 128 ) / 128`, four bytes per word.
*
* ```js
* const loader = new SPZLoader();
* const data = await loader.loadAsync( './models/gsplat/example.spz' );
* scene.add( new GaussianSplatMesh( data ) );
* scene.add( new GaussianSplat( data ) );
* ```
*
* @augments Loader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ const _vector = /*@__PURE__*/ new Vector3();
* both `three/webgpu` and `three/tsl`.
*
* ```js
* const splats = new GaussianSplatMesh( geometry );
* const splats = new GaussianSplat( geometry );
* scene.add( splats );
* ```
*
* @augments Mesh
* @three_import import { GaussianSplatMesh } from 'three/addons/objects/GaussianSplatMesh.js';
* @three_import import { GaussianSplat } from 'three/addons/objects/GaussianSplat.js';
*/
class GaussianSplatMesh extends Mesh {
class GaussianSplat extends Mesh {

/**
* Constructs a new Gaussian splat mesh.
Expand Down Expand Up @@ -122,9 +122,9 @@ class GaussianSplatMesh extends Mesh {
* @readonly
* @default true
*/
this.isGaussianSplatMesh = true;
this.isGaussianSplat = true;

this.type = 'GaussianSplatMesh';
this.type = 'GaussianSplat';

/**
* The source splat geometry.
Expand All @@ -134,15 +134,15 @@ class GaussianSplatMesh extends Mesh {
this.splatGeometry = splatGeometry;

/**
* The bounding box of the splats. Can be computed via {@link GaussianSplatMesh#computeBoundingBox}.
* The bounding box of the splats. Can be computed via {@link GaussianSplat#computeBoundingBox}.
*
* @type {?Box3}
* @default null
*/
this.boundingBox = null;

/**
* The bounding sphere of the splats. Can be computed via {@link GaussianSplatMesh#computeBoundingSphere}.
* The bounding sphere of the splats. Can be computed via {@link GaussianSplat#computeBoundingSphere}.
*
* @type {?Sphere}
* @default null
Expand Down Expand Up @@ -259,7 +259,7 @@ class GaussianSplatMesh extends Mesh {
}

/**
* Computes the bounding box of the splats, updating {@link GaussianSplatMesh#boundingBox}.
* Computes the bounding box of the splats, updating {@link GaussianSplat#boundingBox}.
*
* Each splat is expanded by its own extent rather than treated as a point, so the bounds cover
* what is drawn.
Expand Down Expand Up @@ -295,7 +295,7 @@ class GaussianSplatMesh extends Mesh {
}

/**
* Computes the bounding sphere of the splats, updating {@link GaussianSplatMesh#boundingSphere}.
* Computes the bounding sphere of the splats, updating {@link GaussianSplat#boundingSphere}.
*
* Each splat is expanded by its own extent rather than treated as a point, so the bounds cover
* what is drawn.
Expand Down Expand Up @@ -856,4 +856,4 @@ function createMaterial( vertexNode, fragmentNode ) {

}

export { GaussianSplatMesh };
export { GaussianSplat };
6 changes: 6 additions & 0 deletions examples/jsm/tsl/WebGLNodesHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ class RendererProxy {

}

getCanvasTarget() {

return null;

}

hasCompatibility( name ) {

if ( name === Compatibility.TEXTURE_COMPARE ) {
Expand Down
4 changes: 2 additions & 2 deletions examples/webgpu_gaussian_splat.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { SPLATLoader } from 'three/addons/loaders/SPLATLoader.js';
import { SPZLoader } from 'three/addons/loaders/SPZLoader.js';
import { GaussianSplatMesh } from 'three/addons/objects/GaussianSplatMesh.js';
import { GaussianSplat } from 'three/addons/objects/GaussianSplat.js';
import { Inspector } from 'three/addons/inspector/Inspector.js';

let camera, scene, renderer, controls, splats, splatRoot;
Expand Down Expand Up @@ -148,7 +148,7 @@

disposeCurrentSplats();

splats = new GaussianSplatMesh( splatData, { autoSort: false } );
splats = new GaussianSplat( splatData, { autoSort: false } );
splatRoot = splats;

if ( source.rotation !== undefined ) splatRoot.rotation.copy( source.rotation );
Expand Down
4 changes: 4 additions & 0 deletions src/renderers/common/BundleGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { Group } from '../../objects/Group.js';
* are considered as one render bundle and processed as such by
* the renderer.
*
* Only renderable 3D objects are allowed in a bundle group. Other
* types like lights are not supported and must be added to the scene
* outside of the group.
*
* This module is only fully supported by `WebGPURenderer` with a WebGPU backend.
* With a WebGL backend, the group can technically be rendered but without
* any performance improvements.
Expand Down
4 changes: 2 additions & 2 deletions test/unit/addons/loaders/GLTFLoader.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default QUnit.module( 'Addons', () => {

QUnit.module( 'GLTFLoader', () => {

QUnit.test( 'loads KHR_gaussian_splatting primitives as GaussianSplatMesh', async ( assert ) => {
QUnit.test( 'loads KHR_gaussian_splatting primitives as GaussianSplat', async ( assert ) => {

const loader = new GLTFLoader();
loader.register( function ( parser ) {
Expand All @@ -153,7 +153,7 @@ export default QUnit.module( 'Addons', () => {
const mesh = gltf.scene.children[ 0 ];
const covariances = mesh.splatGeometry.getAttribute( 'covariance' ).array;

assert.ok( mesh.isGaussianSplatMesh, 'creates GaussianSplatMesh' );
assert.ok( mesh.isGaussianSplat, 'creates GaussianSplat' );
assert.deepEqual( Array.from( mesh.splatGeometry.getAttribute( 'position' ).array ), [ 1, 2, 3 ], 'loads centers' );
closeTo( assert, covariances[ 0 ], 4, 'covariance xx' );
closeTo( assert, covariances[ 3 ], 9, 'covariance yy' );
Expand Down