three-instanced-group-mesh

instanced group mesh support for three.js

Usage no npm install needed!

<script type="module">
  import threeInstancedGroupMesh from 'https://cdn.skypack.dev/three-instanced-group-mesh';
</script>

README

three-instanced-group-mesh

Downloads Version License

Instanced Group Mesh support for three.js

Motivation

Three.js supports instancedMesh which is a high performance way to render a large number of meshes with the same geometry and material.

But sometimes the model which needed to be instanced can be a complex group rather than a single mesh. This plugin can helps you easily instancing a complex group of meshes.

NOTE: Object type other than Mesh (like Light, Camera, etc) in the given group will be ignored when instancing

Compatibility

Compatible with three.js with instancedMesh supports, aka r110 and above

Install

$ npm install three-instanced-group-mesh

Usage

Just like THREE.instancedMesh

ES Module

import InstancedGroupMesh from "three-instanced-group-mesh";

const instancedGroupMesh = new InstancedGroupMesh(group, count);
instancedGroupMesh.setMatrixAt(index, matrix)

Browser

<script src="https://unpkg.com/three/build/three.js"></script>
<script src="https://unpkg.com/three-instanced-group-mesh/dist/THREE.InstancedGroupMesh.min.js"></script>
<script>
  const instancedGroupMesh = new THREE.InstancedGroupMesh(group, count);
  instancedGroupMesh.setMatrixAt(index, matrix)
</script>

License

MIT