Project on InstancedMesh
masterTo use ProjectedMaterial with InstancedMesh, you must follow a specific workflow to prepare the geometry and individual instances:
- Prepare Geometry: Call
allocateProjectionData(geometry, instancesCount)on the geometry intended for theInstancedMesh. This must be done before callingprojectInstanceAt. - Project Instances: Use
material.projectInstanceAt(index, instancedMesh, matrix)to project onto a specific instance. - Matrix Update: Ensure you call
matrix.updateMatrix()on your dummy/transform object before passing it toprojectInstanceAt.
// 1. Prepare
allocateProjectionData(geometry, instancesCount)
// 2. Project
dummy.updateMatrix()
material.projectInstanceAt(i, instancedMesh, dummy.matrix)