Moving decal performance issue

I’m developing a project to add and move some decals on a T-shirt.
photo_2024-10-06_09-55-32

If you drag the move button, you can move the decal where you want. But there is a little performance issue related to how the decal moves.
The only solution I found for moving the decal is removing the current decal geometry and creating a new one for each frame like this:

decalMesh.geometry.dispose();
            var decalGeometry =  new DecalGeometry( mesh, decalPos, decalRot, decalScale );
            decalMesh.geometry = decalGeometry;

This solution led to performance issues.

Does anyone have a solution?

It seems like the t-shirt geometry is too big, you can Simplify/Dissolve it.

Or a more drastic approach, require a complete rebuild of your app, edit the texture using UVs and canvas, instead of a decal.

2 Likes

Thank you for your reply, the issue is about deleting and creating decals in each frame.
Your solution about using texture with UVs and canvasTexture 2D is completely feasible and I think it is the best solution, but as you said, this solution requires a complete rebuild of the app.
I’m seeking a solution to optimize the decal movement.

1 Like

Have you tried a low poly t-shirt geometry, did the performance issue persist?

1 Like

Thank you for your reply. Reducing the t-shirt geometry polygons fixed the performance issue.

2 Likes