How clamp edge wrapping a texture image?

Hi~ I’m setting a texture to my model.

texture.wrapS = THREE.ClampToEdgeWrapping;
texture.wrapT = THREE.ClampToEdgeWrapping;

Here is the bad result:

Here is what I wanna:

ClampToEdgeWrapping is the default. The last pixel of the texture stretches to the edge of the mesh.

I have to add a transparent border to the texture image in Photoshop.
This is too cumbersome!

Is there have some way to finish this with js code in runtime? Thank you~!

You can draw the image in the middle of a 2d canvas that is 2 pixels wider and longer than the image, this way you will get a transparent border around. Then you create a texture for THREE from the canvas.

1 Like

Second solution is using decal

1 Like

Thank you. I’m already tried decal. Still have other issue. :joy:

Decal will though the t-shirt modle.