Preserve aspect ratio & dimensions of texture, regardless of object/mesh

I work for a textiles company that is exploring BabylonJS. Our use case is: we are given a number of models (say, of chairs, sofas, etc). We would like to import a model into BabylonJS and use Babylon on the website so a user can swap different textile offerings onto the model. The materials have set repeat dimensions. The problem I am running into is maintaining those dimensions & tiling of the materials on the model. The material always seems to stretch on whatever face it’s on instead of maintaining dimension & tiling. The main issue is that we want to be able to do this without having to manually analyze each model.

Basically, I want to preserve the dimensions of the material irregardless of the model. If a material is 3x15, I want it to be 3x15 on all meshes - cut off if the mesh is smaller, repeated if it’s bigger.

My understanding of uScale and vScale of a texture (from More Materials | Babylon.js Documentation) is that they set the number of tiles in each direction, which is irrelevant to me. It doesn’t matter how many tiles goes onto the mesh, just that it tiles according to the image dimensions.

Is this possible? Thanks.

Hello and welcome!

The main issue will be that you want to NOT touch the source meshes. ANd because of that you will get random UV coordinates (as they are stored in the mesh) which are the one dictating where to display the textures

You can then decide to NOT use UV coordinate from the mesh and instead try to find other source for your texture projection

For instance I used mesh xy in that Node Material: Babylon.js Node Material Editor (