Double mirror Image decal Geometry on curve meshes

I am creating a t-shirt configurator and I use decal geometry to show images on each mesh.
But for sleeves, it appears twice like a mirror
this is my code:

const decalMaterial = new THREE.MeshStandardMaterial(
			{
				normalMap: normalTexture,
				normalScale: new THREE.Vector2(1.5, 1.5),
				map: texture,
				transparent: true,
				depthTest: true,
				depthWrite: false,
				polygonOffset: true,
				polygonOffsetUnits: 1,
				polygonOffsetFactor: -4,
			});
		decalMaterial.map.encoding = THREE.sRGBEncoding;
		decalMaterial.needsUpdate = true;

const newMesh = activeMeshRef.current
			newMesh.geometry.computeBoundingBox();
			var boundingBox = newMesh.geometry.boundingBox;
			position.subVectors(boundingBox.max, boundingBox.min);
			position.multiplyScalar(0.5);
			position.add(boundingBox.min);
			position.applyMatrix4(newMesh.matrixWorld);
			meshSize = getMeshSize(newMesh);
			scale = new THREE.Vector3(width, height, Number(meshSize.z.toFixed(4)))
			ratio = Number((width / height).toFixed(4))
			position.x = +position.x.toFixed(4)
			position.y = +position.y.toFixed(4)
			position.z = +position.z.toFixed(4)
			meshSize.x = +meshSize.x.toFixed(4)
			meshSize.y = +meshSize.y.toFixed(4)
			meshSize.z = +meshSize.z.toFixed(4)
			if (position.z < 0) {
				rot = new THREE.Euler(0, degToRad(180), 0)
			}

		}
		let newDecal = new DecalGeometry(activeMeshRef.current, position, rot, scale);
		const decalMesh = new THREE.Mesh(newDecal, decalMaterial1);
		scene.current.add(decalMesh);

Result:
It is ok in frontside and …

but in sleeves:
Screenshot 2024-06-10 at 12.35.12 AM
Screenshot 2024-06-10 at 12.34.52 AM
Screenshot 2024-06-10 at 12.34.47 AM
Screenshot 2024-06-10 at 12.34.32 AM

and this is my model. Does geometry or uv have any problem? Does decalgeometry work upon UV?

M.glb (694.6 KB)

1 Like

Hey Parisa. :wave:t2:
Can you try to change the z position of the decal to avoid trespassing the mesh? I guess it would work. You can see this in the Rf3 decal example.

I hope it helps :pray:t2: :slightly_smiling_face:

what should I set for z?

Any number that can prevent the decal from entering inside the mesh. See this example:

https://codesandbox.io/p/sandbox/iridescent-decals-forked-psh29w?file=%2Fsrc%2FApp.js%3A25%2C65

why Sandbox not found?

Try again please :slight_smile:

I rotate my decal projection to right,left,backside by 90 ,180, 270 degrees and double image Fixed.I check mesh orientation by names n 3d models.

But I have another problem:
When I have a mesh like this sleeve that is on the right and top of the t-shirt. my decal just covers right side.