Jump to content

UV boundaries to edges


AntoineSfx

Recommended Posts

Is there a way to use the uv created by uvunwrap to create groups of primitives which belongs to the same piece (within the same boundaries)

I like the way uvunwrap creates those  connected components, and I was wondering if there is a way to reuse that information at the geometry level, for example to make an exploded view of the object, or some kind of peeling effect

I know there are a lot of other ways to create groups of connected primitives, but uvunwrap optimizes for flatness and deformation, which makes sense for what I want to do

 

8planes.png

Link to comment
Share on other sites

3 minutes ago, AntoineSfx said:

Thanks, that solved my problem.

Any ideas how the uv islands are computed ? I don't understand from which informations the uv boundaries are computed. e.g. if I wanted to emulate connectivity in a pointwrangle..

I think you can also use the Connectivity SOP node, with the UV function. It creates an attribute that you can later use to define groups.

Link to comment
Share on other sites

no idea how it's computed. i guess it's doable in vex but not trivial. btw. there is UV connectivity selection mode that allows selection UV islands like groups but that's only exposed for viewport selection and it seems you can't address it otherwise... at least I haven't found a way.

Link to comment
Share on other sites

The way you would do your own VEX "Connectivity SOP" with "Use UV Connectivity" and therefore determine a border of your UV is by returning the list of all vertex associated with a point, and check if the UV attribute is the same for each one. If one vertex relative to a point has different UV attrobute, then the primitive it belongs to is on another island.

So to compute the "class" of each island, a non optimal algorithm could be : take a primitive, assign it a "class" number attribute, list its prim neighbours (take its points, and use pointprims function to retrieve the prims containing this point); then for each points of this prim, list the vertices that refer to it; for each vertices, retrieve the prim to which it belong, and assign the same "class" number to neighbour prims only if the vertices refering to the same point have the same UV attribute. If not, skip the primitve. Iterate over all neighbours prims, and for all those prims that has the same "class", list their neighbours that hasn't been assigned a "class" (to avoid infinite loops over the same island), and apply the algorithm until there are no neighbours that (i) hasn't been assigned a class attribute or (ii) that hasn't been skiped in that loop.

Then iterate on the "remaining" primitives (the ones that has not yet been assigned a class or that has been previously skipped because belonging to another island).

I am pretty sure this can be run more efficiently to avoid some prims to be visited several times before being assigned a class, but this should work...

Edited by StepbyStepVFX
Link to comment
Share on other sites

4 minutes ago, StepbyStepVFX said:

The way you would do your own VEX "Connectivity SOP" with "Use UV Connectivity" and therefore determine a border of your UV is by returning the list of all vertex associated with a point, and check if the UV attribute is the same for each one. If one vertex relative to a point has different UV attrobute, then the primitive it belongs to is on another island.

So to compute the "class" of each island, a non optimal algorithm could be : take a primitive, assign it a "class" number attribute, list its prim neighbours (take its points, and use pointprims function to retrieve the prims containing this point); then for each points of this prim, list the vertices that refer to it; for each vertices, retrieve the prim to which it belong, and assign the same "class" number to neighbour prims only if the vertices refering to the same point have the same UV attribute. If not, skip the primitve. Iterate over all neighbours prims, and for all those prims that has the same "class", list their neighbours that hasn't been assigned a "class" (to avoid infinite loops over the same island), and apply the algorithm until there are no neighbours that (i) hasn't been assigned a class attribute or (ii) that hasn't been skiped in that loop.

Then iterate on the "remaining" primitives (the ones that has not yet been assigned a class or that has been previously skipped because belonging to another island).

I am pretty sure this can be run more efficiently to avoid some prims to be visited several times before being assigned a class, but this should work...

Absolutely.. I missed the fact that one point is associated with several vertices, and that when they don't also share the same UV coordinates, it means it's on the boundary..

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...