Scale UV Islands individually from pivot

   4443   5   0
User Avatar
Member
4 posts
Joined: May 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
321 posts
Joined:
Online
Looking for the same.
User Avatar
Member
9249 posts
Joined: July 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 - May 27, 2021 02:57:12

Attachments:
ts_transform_uv_per_island.hip (247.5 KB)

Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
3 posts
Joined: Oct. 2020
Offline
What if you want to move the island to the origin?
User Avatar
Member
5041 posts
Joined: Feb. 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] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
3 posts
Joined: Oct. 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 - April 17, 2023 21:13:16

Attachments:
UVsToOrigin.jpg (342.9 KB)

  • Quick Links