Version: 7.33.0
Background
Currently (7.33.0) there is no way to update vertex data in a MorphTarget
after being added to a MorphTargetManager
and rendered. Because in synchronize()
, the only method that uploads MorphTarget
data to gpu, it only checks the texture size to update, not data inside eash MorphTarget
.
Proposal
Add a MorphTargetManager#forceUpdate
method that rebuilds the texture data, and upload it to GPU via RawTexture2DArray#update
, to avoid disposal and recreation of GPU resources. When underlying data being updated, user should know it, and choose to update the texture or not.
Example here:
Alternatives
- Dispose the
MorphTargetManager
and recreate it, resulting in disposal and recreation of GPU resources, might hurt performance in some cases. - Add a dirty check in
MorphTargetManager
, when aMorphTarget
being updated, mark theMorphTargetManager
as dirty, and check it inMorphTargetManager#synchronize()
, this would cause extra rendering overhead, making performance of existing static morph target worse. - Add a
DynamicMorphTargetManager
extendsMorphTargetManager
, with dirty checks above.