Attribute transfer to UV layer

As a user, I would like to transfer attributes generated in geometry to unwrap my model.
I can make this setup using animation nodes and geometry nodes, but it would be nice to have this setup supported in geometry nodes to enhance its proceduralism.

Iā€™m assuming you meant ā€˜Geometry Nodesā€™ instead of just ā€˜Geometryā€™.

If that is incorrect disregard the rest of my post ;-), because then I donā€™t know what you mean.

Currently, you canā€™t directly write to the UVMap of a mesh. Well, you can. But it changes itā€™s type from an UVMap to a general purpose attribute.

You can use the resulting UVMap in the shader using an ā€˜attributeā€™ input node, instead of an ā€˜UVMapā€™ input node. But itā€™s not perfect, because exporters will just ignore the UVMap. And if you apply the modifier you canā€™t edit the UVmap attribute with the UV editor.

Eventually the plan is that the specialized UVMap type will disappear and be replaced by just a general purpose attribute everywhere in blender. Once that has happened exporters and the UV editor will use the general purpose attribute as well. But this is not very short time. Iā€™m currently busy with a proof-of-concept conversion to find all the problems popping up in this conversion. I hope to post my findings soon(ish).

I meant Geometry Nodes you are correct. Unfortunately, I did not explain what was going on in the image above. The image shows that you can use vertex color (or attributes) generated in geometry nodes to unwrap your mesh and give it proper UVā€™s. The only problem is that I have to use Animation nodes to create the UV layer, so I may transfer the point position attribute that is calculated in geometry nodes to the UV layer. It seems like there could be a new node that works precisely like animation nodes insert UV Map node for geometry nodes. This would work for short-term goals and allow users to unwrap procedural geometry and create proper UV data until a fully generic solution is available. I see what you mean by dependencies and conflicts on how one can affect the UV data, By the UV editor or geometry nodes.

Tool/Node idea for the problem
Say one could use colors or values to mask the meshā€™s regions that mask what system affects the UV Layer data, the UV editor, or geometry nodes. I see this system as a node that uses an array of floats or vectors in geometry nodes like a mixed node base of gradient masking values of what system has control over the UV coordinate position. One could layer and mix the masking in geometry nodes or input vertex color created in the vertex paint editor to create masking regions for what system (Geometry Nodes or UV Editor) takes precedence over the uv shells creation and layout. Or one UV layer for Geometry Nodes and one for the UV Editor to write UV data to. that could be a simpler solution and its not a complex blending system.

Looking forward to your findings, thank you for writing back!

apart from the real issue of not ahving access to UV editing, are you sure you need the 3rd attribute capture node? I think, connecting the comb. xyz directly with the group output should do it.

The third capture node transfers the x-y gradient onto the faceā€™s corners, i.e., vertex polygon winding order. The third capture node makes the polygon faces layout properly in the UV coordinate space. If you have animation nodes, I suggest giving the setup from above a try and playing around with it.

1 Like

No, i donā€™t have animation nodes. Am affraid to mix both in my poor little head. Learning two very similar things at a time is more confusing than helping. But thanks for the insight about the UV stuff. Thereā€™s so little knowledge out there. Frustrating.

As I see it Blender Geo Nodes doesnā€™t see UV Maps as some special data type and it just converts it to generic attribute. And itā€™s not lost after applying geo nodes, you can find it in attribute ā€œUVMapā€.
Iā€™m not sure if Blender is going to ever add an option to convert UVMap attribute to actual UV in geo nodes because itā€™s seems like the opposite of direction it was going with generalizing UV data.

But Iā€™ve found some other manual solution that could be helpful - after applying geo nodes you can run ā€œConvert Attributeā€ with ā€œMode: UV Mapā€ and ā€œUVMapā€ as selected attribute and it will be converted to the actual UV.

You could also do it from code:

a = bpy.context.object.data.attributes
a.active = a['UVMap']
bpy.ops.geometry.attribute_convert(mode='UV_MAP', domain='CORNER', data_type='FLOAT2')

Itā€™s kind of destructive but Iā€™ve found that itā€™s only needed for exporting model. Inside Blender usually you can go without it - by replacing UV with ā€œUVMapā€ attribute everywhere.

4 Likes