Add to existing UV attribute in Geometry nodes

Hi! I’m trying to unwrap my product packaging model in Geometry nodes. I have a box and a separate lid. Both created separately in Geometry nodes. I unwrapped the box body with GN and stored the UV in an attribute “BoxUV”. When I unwrap the separate box lid, I store it in a new attribute “BoxLidUV”. Can I then combine these two attributes in a shader? Or is there a way to store both UVs in one attribute? Can I move the UVs in the UV space somehow? To make the box body and box lid texture continous? As you can see in the images, I have one UV set “BoxUV” with five faces in it and then separate “BoxLidUV” with one face and I’d like to combine those - match the size and position the lid next to the body in the UV space. (White planes in the right are just interpretation of the UVs, not part of the model)


Thanks!!

Hi… You can create a new GN network where you use 2 Object Info nodes to join the 2 objects and then add the named attributes together into a new UV. If you don’t want overlap you can transform the UVs.

If you want to keep things procedural, then you may consider generating the UV’s on the joined objects as one step an they will occupy their own space in UV.

Good luck!

2 Likes

Thank You @zeroskilz ! :slight_smile:

I love the 2 Object info nodes part! As for transforming UVs, how would you do it? I came up to this setup, but I’m not sure it’s the cleanest way to move UVs. Thanks again.

It looks like you’re running a UV unwrap again… that should take care of separating the UVs… I meant only if you were adding existing UVs then you could do Vector Multiply to scale and Vector Add to translate.

Good luck.

1 Like

@zeroskilz separating works fine, what I’m struggling with is scale and position. This map range thing for scale is kinda wobbly and seems overcomplicated to me, but I couldn’t think of a better solution. :confused:

When using a vector map range you should not need to separate the xyz components… just keep the vectors as vectors and it should be less clumsy to work with.

For demonstration purposes I’m splitting the edges to set positions to the UV plane, but that step is not necessary in practice… the only important bit is me demonstrating using Vector Multiply and Vector Add to do the transforms of the UVMap attribute:

Good luck.

3 Likes

@zeroskilz oh great, thank you very much. This is perfect, because the Map Range is the cumsy part.

1 Like

Well, not really… the clumsy part was using Separate XYZ… Many ways to achieve the end result and map range is a valid way to do it as you’re doing scale and translate at the same time, but best to keep things in the Vector domain :wink:

Glad you managed to solve your issue.

1 Like

Hi @zeroskilz , so after I’ve subdivided my mesh, of course it messed with my UVs, so I’m trying to subdivide first and then unwrap. I can’t properly mark the seams to achieve cubical unwrap as I had before. Any ideas?

Thanks!

A quick hack would be to just use the unsigned angle and to sperate out faces facing some cardinal direction…
e.g.:

But it is really up to your particular circumstances and I’m not sure how you wish to parameterize things so can’t help there…

Good luck.

2 Likes