Jump to content
AntoineSfx

UV boundaries to edges

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

Share this post


Link to post
Share on other sites

can't remember 100% but have you checked Game Dev Tools ? there's some feature to turn edge/seam or seam/edge...as said, can't remember

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×