How do I free morph textures

Related: VTF morph targeting with multiple meshes sharing same position/normal attributes · Issue #23095 · mrdoob/three.js · GitHub

I can’t free morph target textures when I unload the model.
Is there any way to explicitly unload the morph target textures?

This should happen automatically since morph target textures are stored in a weak map. So if you call dispose() on the geometry and remove all references to it, the morph target texture should disappear from memory, too.

And to clarify, it is not possible to explicitly free a morph target texture.

Thank you for the clarification.
I’m finding a way to free morph targets when I’m doing unload and load of models in a succession but still am in trouble to achieve without any vram leaks…

low-confidence proposal: isn’t it actually enough to dispose morph textures explicitly? because the only user of the texture refers the texture via the weakmap.get(geometry)

1 Like

This commit looks actually good! Would you be willing to file a PR with this change?

ohhh. Yes I can make a PR.

opened the PR but it seems I can no longer post URLs here :weary:

1 Like

That happens since you are a new user. However, I’ve manually raised your trust level by 1 so posting URLs should work again.