Skip to content

troy351/three-instanced-group-mesh

Repository files navigation

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

About

instance a group of meshes for three.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published