Jump to content

Cut Mesh to UDIM Tiles ?


Recommended Posts

hi, cutting mesh by udim tile is pretty easy with wrangle SOP (or VOPs). but it is very unclear to me what you actually want to do - whether it is to actually cut the mesh or just display which uv tile polygons belong to, or prepare the geometry for uv layout?

Link to comment
Share on other sites

well then:

1 - if you already have you uvs ready and you only want to visualize (without having an udim attribute already present on your geometry). drop down the wrangle SOP and use this code running over the vertices:

int udim_y = floor(@uv.y) * 10;
int udim_x = floor(@uv.x)+1;
i@udim = udim_x + udim_y + 1000;

that will give you an existing udim number for each vertex, that you can then promote to points and use with Visualize SOP to generate random colors for example.

2 - if you want to specify which pieces go to which tile you just simply build an udim primitive integer attribute with desired udim number and then you can feed it into UVLayout SOP (by which I do not mean UV layout program :)) and have your uvs packed into desired uv tiles.

3 - as for cutting the mesh - by that I understand uv seams - there are quite a few ways how to do that. you can either use one of the auto uv options (uV unwrap, or autoseams in H17), or you can build your seems manually with uvflatten SOP. this is a completely separate process that goes before laying out your stuff into udim tiles.

check the docs for uvlayout SOP, uv flatten SOP. it explains pretty well how to deal with uvs

cheers, D.

Edited by davpe
Link to comment
Share on other sites

1 hour ago, davpe said:

2 - if you want to specify which pieces go to which tile you just simply build an udim primitive integer attribute with desired udim number and then you can feed it into UVLayout SOP (by which I do not mean UV layout program :)) and have your uvs packed into desired uv tiles.

Something like i@_udim = 0001; ? Then change the UV attribute by it's default "UV" to "_udim" ? 

I'm cutting the mesh up by selecting edges, then within the UVPelt SOP I choose the edge cut groups.  Although it's not giving the results I want, since the mesh is made up of alot of quad primitives / hard-surface, however you want to look at it.  UVPelt gives as Pelt typically does, a result for organic mesh. Therefore, using the UVLayout SOP set to single tile.  Instead of the mesh unwrapped within a 0-1 range, nothing is seen ?

 

 

Link to comment
Share on other sites

in UVLayout SOP there are several modes of operation. you can set the Packing method to "udim attribute" and it will automatically pick up a primitive attribute named "udim". in h17 this has been redesigned so it works a bit different but essentially you can do the same thing. no need to do any magic with anything, just have a valid udim number (like 1001,1002,etc.) per each primitive and existing uv coordinates. simple as that.

if you want to unwrap a hard surface mesh don't use Pelt. As you said yourself, it's only a good method for organic models. For hard surfaces use UVFlatten.  

hope that answers your questions. otherwise read the docs, you're asking things that are explained really well there, even with a video i think.

cheers. D.

Edited by davpe
Link to comment
Share on other sites

@davpe I assume UVLayout comes after UVFlatten ? 

The flatten worked good, except I can't sew adjacent primitives within the UV view together using the Sew Seams tool within the UVFlatten SOP; in other words, is there not a method to which edges which are shared are highlighted and I can sew and weld those UV islands together ?

As well, can the UV View show UDIM tile numbers ?

Link to comment
Share on other sites

- uv layout comes as a last thing after unwrapping was finished

- sewing in UV Flatten certainly works but there is one nasty caveat: you can only sew uv seams that are in the seams scope of the current node - in other words if you created some uv seams using the current UV Flatten node or if you fed it an existing edge group, you can sew those together. However, if you, fo instance used UV unwrap SOP for quick uv islands and then you want to use UVFlatten SOP to sew some of those together, it's not gonna work. A bit weird but I did not find myself fighting this too much once I've gotten used to the workflow. I pretty much always either use UVFlatten if I want to produce nice uv islands or some auto uv method if I don't care much. I rarely combine those.

- if you want to do that what I just described - UVUnwrap and then sew some islands together, you can, sort of, use UVFuse SOP. But consider it as a last resort option as this tool is not very smart and it basically just fuses vertices that are close to each other in uv space. So that means you first need to manually position you uv islands pretty close to where you want to have them and then use UVFuse to sew nearby vertices. It's lame and time consuming so I don't recommend going this way unless you have to :) If you're running Houdini 17, check out the new auto uv tools that seem to work pretty good.      

- as for highlighting, if you select an edge in uv view, the corresponding opposite uv edge is automatically selected as well so you always see which ones belong together.  

- currently uv view doesn't show udim numbers, it would be a handy addition thou

cheers. D.

  • Thanks 1
Link to comment
Share on other sites

well, not exactly :) uv coordinates (uv islands) know nothing about udims and udim attribute knows nothing about uv coordinates. it's just two sets of numbers that have no inherent relation. the only node in houdini that can use udim attribute in relation to uv coordinates is UVLayout SOP. what is happening is that UVLayout takes care about the best possible distribution of uv islands into a single uv tile. at this point uv coordinates are values between 0 and 1. then it takes a look at the udim attribute and with 1002 for example it knows you want to move everything with that number into that udim tile. with more udims you will see uv coordinate values going beyond 1, but not 1000 something. if you delete the udim attribute after uv layout your uv coordinates will remain intact. 

hope that makes things a bit more clear for you :) 

  • Like 1
Link to comment
Share on other sites

udim merely tells where to remap that 0-1 values. so udim 1001 will stay u:0-1, v:0-1, udim 1002 will become u:1-2, v:0-1, 1003 = u:2-3, v:0-1, 1013 = u:2-3, v:1-2, etc.

if you open Geometry spreadsheet window and list vertex attributes you can inspect what range are the coordinates.

hope it makes sense 

Link to comment
Share on other sites

dude, is there something specific you're trying to achieve here? because honestly I don't understand :) why do you want to convert texture coordinates to udim values? those are two things serving two purposes and there is no way or reason in any existing software to do that kind of conversion. you can extract udim number from texture coordinates but not the other way around. yes, udim attribute does display distribution of uv islands to uv tiles but it is not carrying any more granular information about where exactly individual vertices are located. that's what texture coordinates are good for. 

Link to comment
Share on other sites

21 hours ago, davpe said:

if you open Geometry spreadsheet window and list vertex attributes you can inspect what range are the coordinates.

What do you mean by, what range; if it's within 0-1 space ? 

In the help for the UVLayout SOP read the section on the udim Attribute.  From my understanding each primitive within the UV island have there own udim value; is it not possible to assign each island with it's own udim value ? :)

And with that, although each UV Island has it's own udim value; does Houdini still pack all the islands within the 0-1 UV space ?

Link to comment
Share on other sites

it is within range of 0-1 for the first udim tile and it will be within range of 1-2 (in u coordinate) for udim 1002 and so on. of course you can assign each primitive an udim number and based on that number, uv coordinates will be offset. that is the whole point. why don't you do an experiment? just unwrap any mesh you have into random number of udims, using uvlayout SOP and then inspect what actual numbers you have in the vertex uv attribute. 

Edited by davpe
Link to comment
Share on other sites

On 11/1/2018 at 9:44 PM, davpe said:

it is within range of 0-1 for the first udim tile and it will be within range of 1-2 (in u coordinate) for udim 1002 and so on. of course you can assign each primitive an udim number and based on that number, uv coordinates will be offset. that is the whole point. why don't you do an experiment? just unwrap any mesh you have into random number of udims, using uvlayout SOP and then inspect what actual numbers you have in the vertex uv attribute. 

uvtile.png

@davpe All these UV islands are within a 0-1 range, rather then each UV island on a different udim value as seen in the UV view.  I want to move each UV island to the next udim tile beginning with 1001, and rather then have a udim value displayed for each primitive in UV view as mentioned in the UV Layout documentation. unless I'm not seeing the numbers for the image within the UV Layout documentation, correct ?  I want a udim value displayed for each UV island to which the UV island relates to, with regards to udim values.

The mesh is unwrapped by means of the udim attribute, although; I don't understand what use the vertex values are in the geo spreadsheet with regards to udim values ?

Edited by CinnamonMetal
Link to comment
Share on other sites

look at the picture attached. there is an unwrapped mesh in 3 udims on the left side. on the right side, you can see a geometry spreadsheet with uv coordinate (with u values over 2 since i've got 3 udims) and udim values (called target, 1001-1003). 

udims.thumb.jpg.46b9755c7f60cde586b1a74458a541cb.jpg

Link to comment
Share on other sites

for having your target and island attribute you have to enable creation of those on uvlayout SOP (only H17, all the way at the bottom of the parameter window). if youre using H16 use vex script in my second post to get the udim attribute.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...