UV texture scaling and boxes

Hi there,
as you can see in this PG https://playground.babylonjs.com/#B1Y8L0#1 i apply the same uv mapping texture both to the ground and the box. I want to keep the aspect ratio of the texture so i use uScale and vScale parameter (lines 53-54).
As you can see on the ground mesh it works fine, but not on the box mesh.
Ground and box have the same dimensions.
How can i preserve the correct aspect ratio even on the box?

Thank you in advance.

It is all to do with how the uvs are applied to the different sides of the box. You could try seeing if swapping around values for width, height and depth of the box has different effects on the texture. You would of course have to rotate the box to align with the ground.

You could also try setting the wrap option.

1 Like

I solved in this way; https://playground.babylonjs.com/#B1Y8L0#2 see line 39.
It seems to work pretty well.

Thank you for your suggestions