This class can be used to optimized scenes by converting individual meshes into BatchedMesh. This component is an experimental attempt to implement auto-batching in three.js.
SceneOptimizer is an addon, and must be imported explicitly, see Installation#Addons.
import { SceneOptimizer } from 'three/addons/utils/SceneOptimizer.js';
Constructs a new scene optimizer.
scene
The scene to optimize.
options
The configuration options.
Removes the given array of meshes from the scene.
meshesToRemove
The meshes to remove.
Removes empty nodes from all descendants of the given 3D object.
object
The 3D object to process.
Performs the auto-baching by identifying groups of meshes in the scene that can be represented as a single BatchedMesh. The method modifies the scene by adding instances of BatchedMesh and removing the now redundant individual meshes.
Returns: The optimized scene.
Performs the auto-instancing by identifying groups of meshes in the scene that can be represented as a single InstancedMesh. The method modifies the scene by adding instances of InstancedMesh and removing the now redundant individual meshes.
This method is not yet implemented.
Returns: The optimized scene.
Constructor options of SceneOptimizer.
debug
boolean
Whether to enable debug mode or not.
Default is false.