UV packing?

   9440   5   1
User Avatar
Member
20 posts
Joined: April 2012
Offline
Hi everyone,

I'm pretty new to the forums here (my second post xD).

Anyway I'm working on a project and for that I had to cut a pretty big piece of geometry into smaller parts. I decided to use a Voronoi fracture to do that and it generates results I'm happy with.
However each piece needs UVs, I managed to do that with a foreach loop and some UVProject/Pelt nodes however the UVs of all the pieces are overlapping. Now I tried to use the UVTranslate in the loop to move the UVs of each piece, however I can't really constrain each piece to the 0-1 space at the time of projecting the UVs because I want to keep the resolution fairly consistent for all pieces (which means large pieces get more space in the UVs and small pieces get less space). But because I can't constrain the UVs to the 0-1 space I also don't know how far to move subsequent projections in the loop.

So basically I have a ton of UVs all overlapping and with very different sizes (most extend to outside the 0-1 space though since the geometry is very large).

Now 3D max and Maya both have a tool(s) to pack UVs at the click of a button, however Houdini doesn't seem to have such a tool and I really don't have a clue where I would start making such a tool.
And doing UV packing in max or maya isn't really an option and I'd just like to have a tool within Houdini to take care of this because I'm bound to use this more often than just for this project.

Maybe I'm looking at it the wrong way, but some pointers on doing procedural UVs and specifically packing those UVs so nothing overlaps is something I'd greatly appreciate.



Edit: Well I did figure out a possible way to measure the bounding box of the UVs, so I probably can implement a UVTranslate so nothing overlaps. However it'll probably then place all the UVs in a long strip, instead of neatly packing them. So yeah, pointers are still welcome.
User Avatar
Member
1767 posts
Joined: Oct. 2010
Offline
this is definitely a tricky one and I would love to see what you come up with please post!

I will be putting an RFE to sidefx through my studio for this one as I feel it is key on allowing for proper UV procedurals

one thing that is interesting is that the UVUnwrap actually does lay them out for you. You can maybe try something fancy by using a point SOP to swizzle your UVs with your point positions (so that your UVs become the geometry and your geometry becomes the UVs), the try using SOPs or DOPs to get the UVs to pack in the proper area (i.e. maybe a SOP solver to “simulate” your UV pieces towards a point? crazy stuff)
-G
User Avatar
Member
20 posts
Joined: April 2012
Offline
hehe, thanks. It's still cooking now, but I think I got it solved.

Basically what I do now is project the UVs and just transfer the UVs to 3D space using a simple point node that reads out the UV values and places them into X and Y (leaving Z at 0 since UVs have no depth anyway). This basically creates the UVs in 3D space and then if you apply a UVUnwrap you'll get neatly packed UVs from all the flattened geometry. Then it's simply a vertex node to transfer UVs from the flattened to the 3D geometry and you're done.

The only thing you have to take into account though is that this method only works if the geometry is cut along the UV seams. With my geometry that's the case, so it works fine for me, but if you got a large single piece of geometry you need to cut it up and make sure each separate piece of the geometry is equal to a piece of the UV. Though I guess if you cut up a piece of geometry with a UVUnwrap you don't really need this anyway.

I'll try to make a simple piece of testing geometry and upload the file with the solution. atm I have a large piece of geometry loaded in from an external obj so that isn't that handy to share with you guys xD

Thanks for the tip on the UVUnwrap though and especially about swapping around the UVs to 3D space
User Avatar
Member
1767 posts
Joined: Oct. 2010
Offline
Genius you just made my life a lot happier! Thank u for taking this one home!

For adding the splits in the geo at the UV seams in a large geometry, simply use the vertexSplit SOP, and set ur split attribute to uv
-G
User Avatar
Member
452 posts
Joined: Feb. 2013
Offline
I know this is probably old and forgotten, but I just wanted to thank everyone and add a little (probably obvious ):
You can use a vertex node to feed the vertex split and unwrapped UVs back into the original geo.

- I think it is quite sad you need to hack a UV-layout from Houdini, when they could just make a UV layout node with code they already have.
User Avatar
Member
1767 posts
Joined: Oct. 2010
Offline
If you put your network on a subnet, and save it as a digital asset, then it will not feel like a hack although I do agree that there is functionality in nodes that could be separated out for sure…
-G
  • Quick Links