Scale UV Islands individually from pivot

   2563   5   0
User Avatar
Member
4 posts
Joined: 5月 2019
Offline
So I am wondering if there is any way in Houdini to scale all my UV Islands uniformally, but from their individual pivots as opposed to the center of my UV selection. There may be a VEX solution to this or a way to utilize one of the UV nodes but I haven't seen to much VEX code that deals with UVs.
User Avatar
Member
284 posts
Joined:
Offline
Looking for the same.
User Avatar
Member
8535 posts
Joined: 7月 2007
Offline
you can get island id using connectivity SOP in UV connectivity mode
and then this Vertex Wrangle should take it from there
vector t = chv("t");
vector r = chv("r");
vector s = chv("s")*chf("scale");
string geo = geounwrap(0, "uv");
int island = prim(0, "island", @primnum);
vector center = getbbox_center(geo, "@island=" + itoa(island) );
matrix xform = maketransform(0, 0, t, r, s, center);
v@uv *= xform;
Edited by tamte - 2021年5月27日 02:57:12

Attachments:
ts_transform_uv_per_island.hip (247.5 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
2 posts
Joined: 10月 2020
Offline
What if you want to move the island to the origin?
User Avatar
Member
4500 posts
Joined: 2月 2012
Offline
Bodhi5000
What if you want to move the island to the origin?

Hi,

You can do something like this in a Vertex Wrangle after creating a Connectivity SOP set to use UV Connectivity:

string geo = geounwrap ( 0, "uv" );
int cls = prim ( 0, "class", @primnum );
vector center = getbbox_center ( geo, "@class=" + itoa ( cls ) );
@uv -= center;

Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
2 posts
Joined: 10月 2020
Offline
Holy Wow! I thought this would get lost to time but a response from Animatix! Nice! I've got my Eye on pragmatic vex.

In my particluar situation I'm running a forLoop over individual pieces so I managed to get a UV transform to work.

Edited by Bodhi5000 - 2023年4月17日 21:13:16

Attachments:
UVsToOrigin.jpg (342.9 KB)

  • Quick Links