How to scale a texture's UV 'from' the center?

So, this is something I’ve run into several times… I’m trying to create a simple ‘zoom’ effect within a dynamic material and want to be able to scale a texture’s UV’s while it maintains its position, centered in the material (as opposed to locking to the top left corner and wrapping or tiling).

Does anyone know a way to do this?

69079-scale&centeruv.gif

Hi SVR33 -

We have a Material Function in the Engine called ScaleUVsbyCenter which you can search for in the Material Editor.

Thank You

Eric Ketchum

8 Likes

Holy smokes… I even looked in there for something named exactly like that! Not sure how I missed it. Thank you so much, Eric!

would be interesting to know the math involved in that, I need it for something else.

How would you scale UVs from a given position? As for example (0.7 , 0)?

Take a look at the function Eric mentioned. I’m not at my computer at the moment, but I’m fairly certain it takes a vector 2 “position” input (which is 0.5, 0.5 by default)

1 Like

Got back to my computer to realize that wasn’t right… try “ScaleUVsAroundPoint” function instead.

1 Like

If your center = [0.5;0.5], then
((UV-[0.5;0.5])*Scale)+[0.5;0.5]
Another words, you just move Center Point to [0;0], scale it and return it to its initial position.

3 Likes