BabylonJS texture problem

Hi, I’m a beginner in development with babylonjs,
I’m currently creating a shirt configurator. with angular / babylonjs
I load a scene with all the elements and I do the configuration …
my problem is in the fabric change (jpg image)
I use this code

var material = new BABYLON.StandardMaterial(“texture3”, this.scene);
material.diffuseTexture = new BABYLON.Texture(“assets/textures/T1686.jpg”, this.scene);
this.shirt.material = material;

and I’m loading a fabric picture with
white and blue stripe
and i get this

Pinging @PolygonalSun

But when i try with create sphere
this.sphere = Mesh.CreateSphere(‘sphere1’, 16, 2, this.scene);
const spherMaterial = new StandardMaterial(‘sun_surface’, this.scene);
spherMaterial.diffuseTexture = new Texture(‘assets/textures/T1686.jpg’, this.scene);
this.sphere.material = spherMaterial;
it work

It must be the coordinate textures of the shirt that must be wrong.


Thank you for your answer. How do you change them?

I think you must use an external software like Blender to do that.

1 Like

Hey @Ilyes_ELAYEB,

First of all, welcome to the forums!

Second, for a texture to display properly on a mesh like the shirt you’re using, you would need to provide a texture that is mapped to your mesh’s UV coordinates. Like @Evgeni_Popov said, you’d need an external app to do this like Blender or Maya.

I’m not sure what apps you have access to but this video goes over the basics, with respect to Blender.

1 Like

Thank you so much. You’re a lifesaver.
take care , stay at home :wink: