Resizing texture

I add vScale & uScale to texture based on width and height but i can add it only to 1 side of element like on video works good only on height and dosn’t work on width. How resize texture like on height to both ?

Not sure how you achieve the mesh resize. My guess is - scaling.

If you use scaling, you will need to recalculate the u and vscale in order to fir the new scale. Just made a quick demo of how it might look like:

https://playground.babylonjs.com/#EKFTE3

When growing, the plane keeps the size of texture squares (red and white). when getting smaller, it keeps the number of texture squares the same.

Would be great if you could create a playground of your own to show us what you do, because otherwise we can’t know if our answer is any good

1 Like

Hmm, I meant something different when I change the width and height, the texture should not change the scale but multiply the height and width

well, this is the "growing"effect in my demo.

But again, a playground and a description what you are trying to achieve will be simpler

1 more question to you, you using Scale but how apply this method to width and height of object?

width and height are tricky terms when it comes to a 3d object.
Width can be seen as the horizontal axis (X-Axis), but if the camera rotates around the Y axis ( 90 degrees, let’s say), Width is the Z-Axis. Same goes to height (default - Y Axis).

So I am not sure about width and height in general, but we can talk about width and height (and depth) of a specific object - width, height, depth would be (X,Y,Z). Changing the scaling factor on any specific axis will change the scale of this object. so if you have an object with size 1,1,1 and you want it to be twice “wider” you can set its scaling to (2,1,1).