File: module-SceneUtils.md | Updated: 11/15/2025
SceneUtils is an addon, and must be imported explicitly, see Installation#Addons.
import * as SceneUtils from 'three/addons/utils/SceneUtils.js';
This function creates a mesh for each instance of the given instanced mesh and adds it to a group. Each mesh will honor the current 3D transformation of its corresponding instance.
instancedMesh | The instanced mesh.
---|---
Returns: A group of meshes.
This function creates a mesh for each geometry-group of the given multi-material mesh and adds it to a group.
mesh | The multi-material mesh.
---|---
Returns: A group of meshes.
This function represents an alternative way to create 3D objects with multiple materials. Normally, BufferGeometry#groups are used which might introduce issues e.g. when exporting the object to a 3D format. This function accepts a geometry and an array of materials and creates for each material a mesh that is added to a group.
geometry | The geometry.
---|---
materials | An array of materials.
Returns: A group representing a multi-material object.
Executes a reducer function for each vertex of the given 3D object. reduceVertices() returns a single value: the function's accumulated result.
object | The 3D object that should be processed. It must have a geometry with a position attribute.
---|---
func | The reducer function. First argument is the current value, second argument the current vertex.
initialValue | The initial value.
Returns: The result.
Sorts the instances of the given instanced mesh.
mesh | The instanced mesh to sort.
---|---
compareFn | A custom compare function for the sort.
Generator based alternative to Object3D#traverseAncestors.
object | Object to traverse.
---|---
Objects that passed the filter condition.
Generator based alternative to Object3D#traverse.
object | Object to traverse.
---|---
Objects that passed the filter condition.
Generator based alternative to Object3D#traverseVisible.
object | Object to traverse.
---|---
Objects that passed the filter condition.