0.1.12 • Published 2 years ago

instanced-animation v0.1.12

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Overview

The goal of this module is to allow you to animate a large number of 3D models and control the animation.

By extending Three.js InstancedMesh to automatically generate textures that hold morph information, animations can be performed within the Shader.

Attention

In order for this module to work, you need the Blender Addon that I developed separately.

https://github.com/hamaike-biz/skinning2morph

Install

yarn add instanced-animation

Usage

import InstancedAnimation from 'instanced-animation';

// create instance
const instancedAnimation = new InstancedAnimation(gltf, INSTANCE_COUNT);
scene.add(instancedAnimation.instancedMesh)

// play Animation
instancedAnimation.playAnimation(targetIndex, animName);

// "animName" can be set by using the Blender Addon

The following InstancedMesh features are still available.

object3D.updateMatrix();
instancedMesh.setMatrixAt(instanceIndex, baseObject3D.matrix);
instancedMesh.instanceMatrix.needsUpdate = true;

Methods

playAnimation( targetIndex: number, animationName: string)

targetIndex: Index of the instance for which you want to play the animation.

animationName: Animation name set by Blender.

Note

  • The loaded GLTF is converted to MeshBasicMaterial because it may appear black on low-performance machines when used as StandardMesh.

Blender Addon is here.

https://github.com/hamaike-biz/skinning2morph

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

1.0.0

2 years ago